Hello All,
I have Requirement of Reading the Inserted Objects (Word Doc) from EXCEL File. I am new to ASPOSE. Can some one provide me the sample code ?
Thanks,
Hi
Thanks for your inquiry. I think you can use Aspose.Cells to read embedded OLE objects from the Excel sheet. See the following link for more information.
https://reference.aspose.com/cells/net/aspose.cells.drawing/oleobject/objectdata/
Also see the following code example:
// Open excel workbook
Aspose.Cells.Workbook excelWorkbook = new Aspose.Cells.Workbook();
excelWorkbook.Open(@"Test174\in.xls");
int docCounter = 0;
// Loop though all worksheets
foreach (Aspose.Cells.Worksheet sheet in excelWorkbook.Worksheets)
{
// Loop through all OLE objects
foreach (Aspose.Cells.OleObject oleObj in sheet.OleObjects)
{
if (oleObj.FileType == Aspose.Cells.OleFileType.Doc)
{
// Get bytes of embedded document
byte[] docBytes = oleObj.ObjectData;
// Create new memory stream
MemoryStream docStream = new MemoryStream(docBytes);
// Create new Aspose.Words.Document
Aspose.Words.Document doc = new Aspose.Words.Document(docStream);
// Do some manipulations with document
// ....................
// Save document
doc.Save(String.Format(@"Test174\out_{0}.doc", docCounter));
docCounter++;
}
}
}
But it seems you can achieve this using Aspose.Cell for .NET only. Please contact Aspose.Cells team in the corresponding forum to get more information.
Best regards.