From 91e95bba5a328ec01f6dc3dc68f7429eb1958a37 Mon Sep 17 00:00:00 2001 From: Ramya Sivakumar Date: Fri, 21 Nov 2025 14:28:00 +0530 Subject: [PATCH 1/2] 990103-OLEObject --- Document-Processing-toc.html | 3 ++ ...files-from-an-Excel-workbook-as-streams.md | 43 +++++++++++++++++++ 2 files changed, 46 insertions(+) create mode 100644 Document-Processing/Excel/Excel-Library/NET/faqs/how-to-extract-embedded-OLE-files-from-an-Excel-workbook-as-streams.md diff --git a/Document-Processing-toc.html b/Document-Processing-toc.html index efb36d5ff..0320a67f0 100644 --- a/Document-Processing-toc.html +++ b/Document-Processing-toc.html @@ -5790,6 +5790,9 @@
  • How to avoid conflicts when using multiple versions of Syncfusion libraries?
  • +
  • + How to extract embedded OLE files from an Excel workbook as streams? +
  • diff --git a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-extract-embedded-OLE-files-from-an-Excel-workbook-as-streams.md b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-extract-embedded-OLE-files-from-an-Excel-workbook-as-streams.md new file mode 100644 index 000000000..db2172994 --- /dev/null +++ b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-extract-embedded-OLE-files-from-an-Excel-workbook-as-streams.md @@ -0,0 +1,43 @@ +--- +title: Extract embedded OLE files from Excel as streams | Syncfusion +description: This page shows how to extract embedded OLE objects from Excel as streams using the Syncfusion .NET Excel (XlsIO) library. +platform: document-processing +control: XlsIO +documentation: UG +--- + +# How to extract embedded OLE files from an Excel workbook as streams? + +You can extract OLE objects in an Excel workbook as streams using XlsIO. The following example demonstrates how to retrieve embedded files from a worksheet. +{% tabs %} +{% highlight c# tabtitle="C# [Cross-platform]" %} +using (ExcelEngine excelEngine = new ExcelEngine()) +{ + //Create worksheet + IApplication application = excelEngine.Excel; + application.DefaultVersion = ExcelVersion.Xlsx; + IWorkbook workbook = application.Workbooks.Create(1); + IWorksheet worksheet = workbook.Worksheets[0]; + + FileStream embedStream = new FileStream("../../../Sample.docx", FileMode.Open); + FileStream imageStream = new FileStream("../../../wordIcon.jpg", FileMode.Open); + + //Create image stream + Image image = Image.FromStream(imageStream); + + //Add ole object + IOleObject oleObject = worksheet.OleObjects.Add(embedStream, image, OleObjectType.WordDocument); + + // Get the OLE part stream. + Image image1 = Image.FromStream(worksheet.OleObjects[0].GetEmbeddedOleStream()); + MemoryStream memory = new MemoryStream(image1.ImageData); + + //Saving the workbook as stream + FileStream stream = new FileStream("ExtractedFile.xlsx", FileMode.Create, FileAccess.Write); + memory.CopyTo(stream); + workbook.SaveAs(stream); + stream.Dispose(); +} +{% endhighlight %} + +{% endtabs %} From 7ced804e895f76789f56725f3ab3becf9a12f5b7 Mon Sep 17 00:00:00 2001 From: Ramya Sivakumar Date: Thu, 27 Nov 2025 18:57:03 +0530 Subject: [PATCH 2/2] 990103-OLEObject --- Document-Processing-toc.html | 3 --- 1 file changed, 3 deletions(-) diff --git a/Document-Processing-toc.html b/Document-Processing-toc.html index 0320a67f0..efb36d5ff 100644 --- a/Document-Processing-toc.html +++ b/Document-Processing-toc.html @@ -5790,9 +5790,6 @@
  • How to avoid conflicts when using multiple versions of Syncfusion libraries?
  • -
  • - How to extract embedded OLE files from an Excel workbook as streams? -