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

Free Support Forum - aspose.com

Insert one document into another document

Hi,

I would like to copy the content of one document into another document with Apose.Words for Java.

For this reason I copied the example http://www.aspose.com/documentation/file-format-components/aspose.words-for-.net-and-java/insert-a-document-into-another-document.html into my Java development environment (without any changes).

Unfortunately I got an error in the line where looping through all sections in the source document.

// Loop through all sections in the source document.

for (Section srcSection : srcDoc.getSections())

The error says: "type mismatch: cannot convert from element type Node to Section"

But the description of getSections() says that it returns a SectionCollection.

Is this maybe an implementation error that is fixed in a newer Aspose.words Release??

Thanks for your support.
(I've searched in the forum before I wrote this question. Couldn't find something suitable).

Best regards,

Ulrike


This message was posted using Page2Forum from Document - Aspose.Words for .NET and Java

Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your inquiry. The code works fine on my side. I use the latest version of Aspose.Words for java for testing.

http://www.aspose.com/community/files/51/file-format-components/aspose.words/entry151553.aspx

Also I think you can solve the problem using the following code to loop though sections.

for(int sectIdx=0; sectIdx<srcDoc.getSections().getCount(); sectIdx++)

{

Section srcSection = srcDoc.getSections().get(sectIdx);

Hope this helps.

Best regards.

Hi,

thanks for your fast answer!

I've just downloaded the latest version of Aspose.Words for Java and with this the error disappeared!!

Best regards

Ulrike