コード例 #1
0
        public void ExtractPictures()
        {
            if (Drawing != null)
            {
                MsofbtDgContainer dgContainer = Drawing.FindChild <MsofbtDgContainer>();
                if (dgContainer != null)
                {
                    MsofbtSpgrContainer spgrContainer = dgContainer.FindChild <MsofbtSpgrContainer>();

                    List <MsofbtSpContainer> spContainers = spgrContainer.FindChildren <MsofbtSpContainer>();

                    foreach (MsofbtSpContainer spContainer in spContainers)
                    {
                        MsofbtOPT          opt    = spContainer.FindChild <MsofbtOPT>();
                        MsofbtClientAnchor anchor = spContainer.FindChild <MsofbtClientAnchor>();

                        if (opt != null && anchor != null)
                        {
                            foreach (ShapeProperty prop in opt.Properties)
                            {
                                if (prop.PropertyID == PropertyIDs.BlipId)
                                {
                                    int     imageIndex = (int)prop.PropertyValue - 1;
                                    Picture pic        = new Picture();
                                    pic.TopLeftCorner.RowIndex     = anchor.Row1;
                                    pic.TopLeftCorner.ColIndex     = anchor.Col1;
                                    pic.TopLeftCorner.DX           = anchor.DX1;
                                    pic.TopLeftCorner.DY           = anchor.DY1;
                                    pic.BottomRightCorner.RowIndex = anchor.Row2;
                                    pic.BottomRightCorner.ColIndex = anchor.Col2;
                                    pic.BottomRightCorner.DX       = anchor.DX2;
                                    pic.BottomRightCorner.DY       = anchor.DY2;
                                    pic.Image             = Book.ExtractImage(imageIndex);
                                    pictures[pic.CellPos] = pic;
                                    break;
                                }
                            }
                        }
                    }
                }
            }
        }
コード例 #2
0
 public void ExtractPictures()
 {
     if (this.Drawing != null)
     {
         MsofbtDgContainer msofbtDgContainer = this.Drawing.FindChild <MsofbtDgContainer>();
         if (msofbtDgContainer != null)
         {
             MsofbtSpgrContainer      msofbtSpgrContainer = msofbtDgContainer.FindChild <MsofbtSpgrContainer>();
             List <MsofbtSpContainer> list = msofbtSpgrContainer.FindChildren <MsofbtSpContainer>();
             foreach (MsofbtSpContainer current in list)
             {
                 MsofbtOPT          msofbtOPT          = current.FindChild <MsofbtOPT>();
                 MsofbtClientAnchor msofbtClientAnchor = current.FindChild <MsofbtClientAnchor>();
                 if (msofbtOPT != null && msofbtClientAnchor != null)
                 {
                     foreach (ShapeProperty current2 in msofbtOPT.Properties)
                     {
                         if (current2.PropertyID == PropertyIDs.BlipId)
                         {
                             int     index   = checked ((int)current2.PropertyValue - 1);
                             Picture picture = new Picture();
                             picture.TopLeftCorner.RowIndex     = msofbtClientAnchor.Row1;
                             picture.TopLeftCorner.ColIndex     = msofbtClientAnchor.Col1;
                             picture.TopLeftCorner.DX           = msofbtClientAnchor.DX1;
                             picture.TopLeftCorner.DY           = msofbtClientAnchor.DY1;
                             picture.BottomRightCorner.RowIndex = msofbtClientAnchor.Row2;
                             picture.BottomRightCorner.ColIndex = msofbtClientAnchor.Col2;
                             picture.BottomRightCorner.DX       = msofbtClientAnchor.DX2;
                             picture.BottomRightCorner.DY       = msofbtClientAnchor.DY2;
                             picture.Image = this.Book.ExtractImage(index);
                             this.pictures[picture.CellPos] = picture;
                             break;
                         }
                     }
                 }
             }
         }
     }
 }