We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Insert an Embedded or Linked OLE Object (PDF, Excel Files etc) Stream as Icon into Word DOCX Document using C# .NET


What is the method to insert Word document to a main document and shown as ico?

Thanks for your help.


Please use the DocumentBuilder.InsertOleObjectAsIcon method to insert an embedded or linked OLE object (Word, Excel files etc) as icon into the Word document. It allows to specify icon file and caption. Sample code is as follows:

Document doc = new Document("C:\\temp\\input.docx");
DocumentBuilder builder = new DocumentBuilder(doc);


builder.InsertOleObjectAsIcon("C:\\temp\\a word file.docx", true, "C:\\Temp\\an icon file.ico", "an icon caption");


Thanks for your reply.
Howver, I try builder.InsertOleObjectAsIcon(DocFile, true, DocIcoFile, DocFilenameWithExt), there is no any file embedded as ico in the output based on Aspose.word.dll(v20.7) and based on VB.net 2008.

I try another way by old version V18.7 like this builder.InsertOleObject(Stream, FileName, True, IcoFileImg), this can embed doc inserted to main doc and shown as ico, but the ico caption is missing, how to fix it, Or how to display the ico caption with filename?



We suggest you to please upgrade to the latest 20.9 version of Aspose.Words for .NET and see how it goes on your end? In case the problem still remains, please ZIP and attach the following resources here for testing:

  • Your simplified input Word document
  • The other DOCX file that you want to insert as an Icon
  • The Icon file
  • Aspose.Words for .NET 20.9 generated output DOCX file showing the undesired behavior
  • Your expected DOCX file showing the desired output. You can create this document manually by using MS Word.
  • Please also create a standalone simple Console application (source code without compilation errors) that helps us to reproduce your current problem on our end and attach it here for testing. Please do not include Aspose.Words DLL files in it to reduce the file size.

As soon as you get these pieces of information ready, we will start further investigation into your particular scenario/issue and provide you more information.