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

Free Support Forum - aspose.com

Embedding Word Documents in Spreadsheets

Is that a supported feature?


This message was posted using Page2Forum from OleObjects Property - Aspose.Cells for .NET and Java

Hi,

Yes, Aspose.Cells supports to set/get OLE Objects including Word Documents in the excel files.

May the following sample code help you for your need, kindly consult it.

Sample code:

//Instantiate a new Workbook.
Workbook workbook = new Workbook();
//Get the first worksheet.
Worksheet sheet = workbook.Worksheets[0];
//Define a string variable to store the image path.
string ImageUrl = @"f:\test\school.jpg";
//Get the picture into the streams.
FileStream fs = File.OpenRead(ImageUrl);
//Define a byte array.
byte[] imageData = new Byte[fs.Length];
//Obtain the picture into the array of bytes from streams.
fs.Read(imageData, 0, imageData.Length);
//Close the stream.
fs.Close();
//Get the doc file path in a variable.
string path = @"f:\test\DocumentTest.doc";
//Get the file into the streams.
fs = File.OpenRead(path);
//Define an array of bytes.
byte[] objectData = new Byte[fs.Length];
//Store the file from streams.
fs.Read(objectData, 0, objectData.Length);
//Close the stream.
fs.Close();
//Add an Ole object into the worksheet with the image
//shown in MS Excel.
sheet.OleObjects.Add(14, 3, 200, 220, imageData);
//Set embedded ole object data.
sheet.OleObjects[0].ObjectData = objectData;
//Save the excel file
workbook.Save(@"f:\test\tstlolebjects.xls");

And for further reference, please check the doc link: http://www.aspose.com/documentation/file-format-components/aspose.cells-for-.net-and-java/managing-ole-objects.html
Thank you.