Effective way to work with word document

Guys,


Here is a use case:
  • I have a word template for filling.
  • I need to fill customer data into the template (text fields, rarely checkboxes, totally about 100 fields on 4-8 pages).
  • Export result to PDF.
  • Process thousands of documents in batch mode in a limited time-frame, so performance is significant.
Considering the fact that it is not easy to address objects in word’s tree-like structure, what approaches would you recommend to work with the document efficiently (from performance point of view)?
  • Place some template text like {Customer.LegalAddress.Street}, search such text with RegEx and replace template text with real data (I think it’s extremely time consuming).
  • Place form fields in the document and work with form fields only (not sure that form fields support is well implemented <see <a href="https://forum.aspose.com/t/57271> and it will be faster).
  • Use Mail Merge, but the problem is customer data structure is not plain object. It may contain some variable-length sub-items.
  • Other approaches.
So, could you please share ideas how to work with your product in effective way.

Best regards,
Alex.

Hi Alex,


Thanks for your inquiry. In your case, I suggest you please use Mail Merge to achieve your requirements. Please read following documentation link for your kind reference.

It would be great if you please share your MS Word template document and data source/data structure here for our reference. We will then provide you more information about your scenario along with code.

Thank you, guys!

It seems I already managed to write working code for mail merge.
It’s awesome that the library provides ability to perform mail merge for nested regions.

Hi Alex,


Thanks for your feedback. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.