Free Support Forum - aspose.com

Inserting content in a section from a different document

Hi,

I have a 3 page document which requires an insertion of a table from another template in the 2nd page.The content of the 3rd page should be continued after this table.Is this possible using sections? Kindly, let me know if it can be done by any other means or any supportive resource which I can refer to to implement this requirement.

Thanks and Regards,
Pavithra V.S

Hi

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

Thanks for you request. First of all please note there is no way to determine where page starts or ends using Aspose.Words. if you need to insert some node at the particular location in your document, you can use bookmark. I think the code provided in the following article could be useful for you:

http://www.aspose.com/documentation/file-format-components/aspose.words-for-.net-and-java/insert-a-document-into-another-document.html

Please let me know if you need more assistance, I will be glad to help you. You can also attach your documents here and I will try to create sample code for you, is it is needed.

Best regards.

Thank you for the reply.That resource was indeed useful.

I am trying to insert a table from the document called "BookMarkDocument"(Please find attached) at a bookmark called "Test" in a document called "MainDocument"(Please Find attached).I used the method "InsertDocument" exactly as mentioned in
http://www.aspose.com/documentation/file-format-components/aspose.words-for-.net-and-java/insert-a-document-into-another-document.html

If I do that, I am getting an error saying "Cannot insert a node of this type at this location" at the following line of code

dstStory.insertAfter(newNode, insertAfterNode);

Kindly, let me know how I can resolve this issue

Regards,
Pavithra V.S

Hi

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

Thanks for your inquiry. I just answered this question in the following thread:

Best regards.

Hi,
This worked when the table from a different document was a static table.As in, if it didn't have a Region within itself , it worked fine.Now, the table I have, has a region "TableStart:XYZ"....THE TABLE..... "TableEnd:XYZ"
which will iterate and populate the rows of the table based on the number of items in the datasource passed to it. This table is being inserted within a region in another document.This Scenario leads to nested regions which is not supported by Aspose.
How do I resolve this situation? Kindly, Let me know.

Regards,
Pavithra V.S

Hi

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

Thank you for your inquiry. Yes, you are right; there is no direct way to populate nested regions using Aspsoe.Words. It is possible, however, to generate the above reports by performing mail merge several times and building up a resulting document from several documents or fragments. The Product Catalog and Sales Invoice samples in the demo project supplied with Aspose.Words demonstrate the suggested techniques.

http://www.aspose.com/demos/file-format-components/aspose.words/java/product-catalog.jsf

Hope this helps.

Best regards.

Hi,
Thanks for the reply.I was able to implement that.Now, the issue is that the text that is getting inserted is in some other font.(Neither the parent document's nor the destination document's).Is there a way to manipulate and set the font of the text in the table that I am inserting? Kindly, let me know

Regards,
Pavithra V.S

Hi

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

Thanks for your request. I suppose, you use mail merge to fill your documents with data, so you can specify font in your templates. If font is changed during processing the document using Aspose.Words, please attach this document here for testing.

Best regards.

Hi,
Thanks for the very quick reply! Here are the two documents that I am trying to implement with.The document named "Destination" has a bookmark called "Bookmark".Here is where the table from the other document named "Sourcebookmark" will be inserted. As both of them have regions, I am using a dummy intermediate document which doesn't have regions to do the transfer of content from "Sourcebookmark" to "Destination".
Both the documents have the font as Arial size 10.But in the final document, the inserted text is in calibri

Please find the attached documents

Hi

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

Thank you for additional information. Could you please also attach your output document and provide me sample code that will allow me to reproduce the problem?

I used the following code for testing and output document looks fine, font is correct.

// Open documents

Document doc1 = new Document("C:\\Temp\\Destination.doc");

Document doc2 = new Document("C:\\Temp\\Sourcebookmark.doc");

// create DocumentBuilder

DocumentBuilder builder = new DocumentBuilder(doc1);

// Move DocumentBuilder cursor to the bookmark

builder.moveToBookmark("Bookmark");

// Insert source docuemnt at bookmarks

InsertDocument(builder.getCurrentParagraph(), doc2);

// Save output document

doc1.save("C:\\Temp\\out.doc");

Best regards.

I think, the problem arises when the document’s content is being passed via the intermediate blank regionless document though all the font settings in it are same as the source and destination.I am attaching the output as well.Please let me know if anything else could trigger such an issue.
I am not using the documentBuilder, but using sections to insert from different documents.

Thank you for additional information. As I can see, the font in this document is the same as in your source document (Arial, regular, size 10).

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

Best regards.

By Sample Output I meant, That is how the document should look.But the output that is being generated at my end has Calibri instead of Arial

Thank you for additional information. The document you have attached looks exactly the same as document produced on my side. So, please provide me sample code that will allow me to reproduce the problem. I will check it on my side and provide you more information.

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

Best regards.

The issues you have found earlier (filed as 39) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(50)

Hi Alexey,
Does this notification mean that "Nested Merge fields" are supported in the latest update? Kindly, confirm and clarify.
Regards,
Pavithra V S

Hi

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

Thanks for your request. The latest version of Aspose.Words supports nested mail merge regions and it allows you to generate reports from master-detail (parent-child) data. You can download the latest version of Aspose.Words from here:

http://www.aspose.com/community/files/51/.net-components/aspose.words-for-.net/category1188.aspx

Also, see the following blog to learn more about this feature:

http://www.aspose.com/community/blogs/aspose.words-product-family/archive/2009/11/13/aspose-words-for-net-8-0-supports-nested-mail-merge-regions-and-more.aspx

Please let me know if you need more assistance or additional information.

Best regards.

Thank you so much for the resourceful link.

As I understand the concept, a table of the following kind should be possible to be generated. Kindly, let me know if this is possible.I need confirmation on vertical iteration(columns getting proliferated when there is data). I have worked on rows getting iterated. But, not sure if the same works with columns.
Table 1 when exectured with data source should give Table2

Table1

TableStart:Parent
Static Text TableStart:Child 1
TableStart:Child2
TableEnd:Child2
TableEnd:Child1
TableEnd:Parent

Table2

Parent Header
Static Text Child1's column1 Header Child1's column2 Header
Child2's
Column1
Child2's
Column2
Child2's
Column3
Child2's
Column1
Child2's
Column2
Child2's
Column 3
Child1's Column1 Footer Child1's Column2 Footer
Parent Footer

Thanks for all the help.
Regards,
Pavithra V S

Hi

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

Thanks for your request. No, there is no direct way to grow table horizontally, i.e. add columns dynamically. It is possible, however, by performing additional coding. Here you can find an example:

Hope this helps.

Best regards.

The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan