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

Free Support Forum - aspose.com

Failed to save Workbook after OleObject data modified

Hi,

In the attached zip file, I have demo.xls which contains an embedded OleObject (embedded_before.ppt).
After this file was loaded into an Workbook object, I tried to modify the content of this OleObject to embedded_after.ppt

workbook.Worksheets[0].OleObjects[0].ObjectData = File.ReadAllBytes(embedded_after);

But after ObjectData was modified, I cannot use SaveToStream() or any other Save method anymore. It throws an exception with message:

The structured storage seems to be corrupt.

I’ve tried different embedded file types but only Powerpoint 2003 files (PPT, PPS, POT) cause the error. The PPT files was load and saved using Aspose Slides.

Any information regarding this issue would be helpful. Thanks.

demo.zip (77.8 KB)

@hatanlinh13,

Which version of Aspose.Cells for .NET you are using? I used latest version/fix: Aspose.Cells for .NET v20.6.5 (attached) and it works fine.
Aspose.Cells20.6.5 For .Net2_AuthenticodeSigned.Zip (5.4 MB)
Aspose.Cells20.6.5 For .Net4.0.Zip (5.4 MB)
Aspose.Cells20.6.5 For .NetStandard20.Zip (5.3 MB)

I used the following sample code and generated the output file. The output file is fine tuned. Also, I did not get any exception:
e.g
Sample code:

using (var workbook = new Workbook("e:\\test2\\demo\\demo.xls", new LoadOptions(LoadFormat.Excel97To2003)))
            {
                OleObject newEmbeddedObject = workbook.Worksheets[0].OleObjects[0];
                newEmbeddedObject.ObjectData = File.ReadAllBytes("e:\\test2\\demo\\embedded_after.ppt");
                workbook.Save("e:\\test2\\demo\\out1.xls", SaveFormat.Excel97To2003);
            } 

Let us know if you still find any issue with v20.6.x.

Thank you for your answer, I’ve tested with Aspose version 20.6 above and everything is OK now. And if you concern, previously I used Aspose Cells version 19.10.0 which causes the problem.

@hatanlinh13,
You are welcome.Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.