DocumentBuilderInsertOleObjectAsIcon Method |
Inserts an embedded or linked OLE object as icon into the document.
Allows to specify icon file and caption. Detects OLE object type using file extension.
Namespace:
Aspose.Words
Assembly:
Aspose.Words (in Aspose.Words.dll) Version: 20.3
Syntaxpublic Shape InsertOleObjectAsIcon(
string fileName,
bool isLinked,
string iconFile,
string iconCaption
)
Public Function InsertOleObjectAsIcon (
fileName As String,
isLinked As Boolean,
iconFile As String,
iconCaption As String
) As Shape
public:
Shape^ InsertOleObjectAsIcon(
String^ fileName,
bool isLinked,
String^ iconFile,
String^ iconCaption
)
member InsertOleObjectAsIcon :
fileName : string *
isLinked : bool *
iconFile : string *
iconCaption : string -> Shape
Parameters
- fileName
- Type: SystemString
Full path to the file. - isLinked
- Type: SystemBoolean
If true then linked OLE object is inserted otherwise embedded OLE object is inserted.
- iconFile
- Type: SystemString
Full path to the ICO file. If the value is null, Aspose.Words will use a predefined image.
- iconCaption
- Type: SystemString
Icon caption.
Return Value
Type:
ShapeShape node containing Ole object and inserted at the current Builder position.
ExamplesShows how to insert an OLE object into a document.
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
Image representingImage = Image.FromFile(ImageDir + "Logo.jpg");
builder.InsertOleObject(MyDir + "Spreadsheet.xlsx", false, false, representingImage);
builder.InsertOleObject(MyDir + "Spreadsheet.xlsx", "Excel.Sheet", false, true, null);
builder.InsertOleObjectAsIcon(MyDir + "Spreadsheet.xlsx", false, ImageDir + "Logo icon.ico",
"Caption (can not be null)");
doc.Save(ArtifactsDir + "DocumentBuilder.InsertOleObject.docx");
See Also