Free Support Forum -

NullReferenceException in Document.Save Method

The attached Word document fails during the Save() method.

Repro code:

Aspose.Word.Document doc = new Aspose.Word.Document(“testtemplate.doc”);
System.IO.MemoryStream ms = new System.IO.MemoryStream();
doc.Save(ms, Aspose.Word.SaveFormat.FormatAsposePdf);


at ᠉.᡼.ᖘ(ᘎ ᔺ, Ꮢ ်)
at ᠉.᡼.ᢃ(Cell ᔺ)
at ᠉.᠈.VisitCellStart(Cell cell)
at Aspose.Word.Cell.Accept(DocumentVisitor visitor)
at Aspose.Word.CompositeNode.ඔ(DocumentVisitor ੌ)
at Aspose.Word.Row.Accept(DocumentVisitor visitor)
at Aspose.Word.CompositeNode.ඔ(DocumentVisitor ੌ)
at Aspose.Word.Table.Accept(DocumentVisitor visitor)
at Aspose.Word.CompositeNode.ඔ(DocumentVisitor ੌ)
at Aspose.Word.Body.Accept(DocumentVisitor visitor)
at ᠉.᠈.ូ(Section ᓬ)
at ᠉.᠈.᠑(Document ᗇ, Stream Ը, String ް)
at Aspose.Word.Document.ർ(Stream Ը, String ް, SaveFormat ൽ)
at Aspose.Word.Document.Save(Stream stream, SaveFormat fileFormat)

The problem is caused by "Coverage for Vacant Buildings" table. When I resize it in MS Word it screws up completely. Try to remove it and create a new one form scratch. Use this as a temporary workaround

I will make a further research of this issue and inform you afterwards.

I have logged this problem to our defect base as issue #853. We will research it and post the results here in this thread.

The table contains a column with zero width (which I believe is actually not valid in a Word file) and this caused the export to PDF algorithm to fail. Fixed in Aspose.Words 3.5.2 which is now available for download on: