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

Free Support Forum - aspose.com

Changing Sheet Data inside Word Doc

Hi all,

I’m trying to update contents of a worksheet in a word doc, but the problem is that I can’t update Shape’s OleFormat data:

Aspose.Words.NodeCollection shapes = doc.GetChildNodes(NodeType.Shape, true);
int i = 0;
foreach (Shape shape in shapes)
if (shape.OleFormat != null)

MemoryStream stream = new MemoryStream();
stream.Seek(0, SeekOrigin.Begin);

Aspose.Cells.Workbook newExcelDoc = new Aspose.Cells.Workbook(stream);

Aspose.Cells.Worksheet sheet = newExcelDoc.Worksheets[0];

sheet.Cells[“A1”].Value = “Test!”;

//Here I want to update shape.OleFormat’s stream
//but changes are made to stream not the Shape.OleFormat itself!

Hi Tooraj,

Thanks for your inquiry. Unfortunately, Aspose.Words does not support the requested feature at the moment. However, I have logged this feature request as WORDSNET-10573 in our issue tracking system. You will be notified via this forum thread once this feature is available. We apologize for your inconvenience.

However, you can insert an embedded or linked OLE object from a file into the document using DocumentBuilder.InsertOleObject. Please check the following code example for your kind reference.

Document doc = new Document();

DocumentBuilder builder = new DocumentBuilder(doc);

Stream memoryStream = File.OpenRead(MyDir + “Book1.xls”);

Shape oleObject = builder.InsertOleObject(memoryStream, “Excel.Sheet.8”, true, null);

doc.Save(MyDir + @“out.docx”);

Hi Tooraj,

Thanks for your patience. I am afraid this issue WORDSNET-10573 has now been postponed till a later date due to some other important issues and new features. We will inform you as soon as there are any further developments. We apologize for your inconvenience.

As a workaround of this issue, please use the DocumentBuilder.InsertOleObject method to insert an embedded or linked OLE object from a file into the
document and remove the exiting OLE object.