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; } } } } } } }
public void AddPicture(Picture pic) { pictures[pic.CellPos] = pic; }