Free Support Forum -

Section.AppendContent Method to Insert/Append Copy of Content in Word Document


I’m currently facing problems when appending the complete content of a document to a template using the Section.AppendContent method. (I’m appending all sections sequentially)

If (and only if) images are included in the document that is appended, and if these images are not “real” images but e.g. excel charts, I get a Null Reference Exception as follows when saving the result (sorry its german):
Der Objektverweis wurde nicht auf eine Objektinstanz festgelegt.
at A_0)
at A_0)
at A_0)
at A_0, am A_1)
at Aspose.Word.RW.Doc.Writer.b.b(s A_0)
at Aspose.Word.Model.s.a(Object A_0)
at Aspose.Word.Model.c.b(Object A_0)
at Aspose.Word.Model.z.a(Object A_0)
at Aspose.Word.Model.c.b(Object A_0)
at Aspose.Word.Model.p.a(Object A_0)
at Aspose.Word.Model.c.b(Object A_0)
at Aspose.Word.Model.f.a(Object A_0)
at Aspose.Word.Model.c.b(Object A_0)
at Aspose.Word.Model.c.a(Object A_0)
at Aspose.Word.Model.c.b(Object A_0)
at Aspose.Word.Model.h.a(Object A_0)
at Aspose.Word.RW.Doc.Writer.b.a(h A_0)
at Aspose.Word.RW.Doc.Writer.b.a(h A_0, String A_1)
at Aspose.Word.Document.Save(String fileName, SaveFormat fileFormat)
at Aspose.Word.Document.Save(String fileName)
at ConsoleApplication1.Module1.Main() in C:\Dokumente und Einstellungen\afels

If I use an empty template this error does not occur!

Aspose.Word version is

I can send U an example project as well as used templates and documents if u wish.

Send the documents to please.

If you download and use the latest version of Aspose.Word.dll - it does not throw and appends the section and saves without throwing an exception.

However, the object you have there is quite complicated. It looks something like a slide with a chart and a textbox in it. Aspose.Word has some problems dealing with the textbox in this slide and the textbox gets lost and the chart somehow appears second time in the bottom right corner of the chart.

We will fix this issue later, but as a workaround I would suggest you remove the textbox from the slide, you can probably add the text and place it over the chart right in MS Word.

great, works now.
Thanks a lot