DocumentBuilderInsertOleObject Method (String, String, Boolean, Boolean, Image) |
Namespace: Aspose.Words
public Shape InsertOleObject( string fileName, string progId, bool isLinked, bool asIcon, Image presentation )
Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); using (SKBitmap representingImage = SKBitmap.Decode(ImageDir + "Logo.jpg")) { // OleObject builder.InsertOleObject(MyDir + "Spreadsheet.xlsx", false, false, representingImage); // OleObject with ProgId builder.InsertOleObject(MyDir + "Spreadsheet.xlsx", "Excel.Sheet", false, false, representingImage); } doc.Save(ArtifactsDir + "DocumentBuilder.InsertOleObjectNetStandard2.docx");
Document doc = new Document(); DocumentBuilder builder = new DocumentBuilder(doc); Image representingImage = Image.FromFile(ImageDir + "Logo.jpg"); // Insert ole object builder.InsertOleObject(MyDir + "Spreadsheet.xlsx", false, false, representingImage); // Insert ole object with ProgId builder.InsertOleObject(MyDir + "Spreadsheet.xlsx", "Excel.Sheet", false, true, null); // Insert ole object as Icon // There is one limitation for now: the maximum size of the icon must be 32x32 for the correct display builder.InsertOleObjectAsIcon(MyDir + "Spreadsheet.xlsx", false, ImageDir + "Logo icon.ico", "Caption (can not be null)"); doc.Save(ArtifactsDir + "DocumentBuilder.InsertOleObject.docx");