Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Tue Feb 07, 2017 5:42 am

Hey,

This question is more of a "is this possible using Spire?" sort of question

I am currently using spire to generate word and/or PDF documents, I have a template document with tags inside of it i.e <Name> I use the Replace function to replace the tag with the correct data
Code: Select all
Doc.Replace("<Name>",NameObject;)

This works but it can be very costly at time as it searches through the entire document if there's multiple tags.

So my question is, can Spire populate documents with data from a database similar to SSRS, in which you provide a data source and set the results inside of the document?

Something similar to this?

https://msdn.microsoft.com/en-us/library/wfk2wb04.aspx

Thanks for any feed back

Dylan_Spire
 
Posts: 18
Joined: Wed Jun 15, 2016 1:28 am

Tue Feb 07, 2017 8:02 am

Dear Dylan_Spire,

Thanks for your inquiry.
I think the mail merge function can meet your requirement. And here is a guide for your kind reference.
https://www.e-iceblue.com/Tutorials/Spi ... eport.html
If there is any question, please let me know and provide us more information.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Wed Feb 08, 2017 3:55 am

Thanks, that helps!

Second question, would Spire have the capability of conditionally displaying a paragraph and/or table using a mail merge field?

For reference, inside of Microsoft Word you can create a rule based on the mail merge fields to display different sections of the document, can Spire do this?

i.e.
Code: Select all
{ IF [Condition] [Display Result 1] [Display Result 2] }

Dylan_Spire
 
Posts: 18
Joined: Wed Jun 15, 2016 1:28 am

Wed Feb 08, 2017 6:50 am

Dear Dylan_Spire,

Thanks for your feedback.
For your second needs, you need to create the corresponding templete file and then mail merge using Spire.
Here is sample for template file.
Code: Select all
 { IF «T1»=«T2» «R1» «R2» \* MERGEFORMAT }

Entire field code:
Code: Select all
{ IF { MERGEFIELD  T1  \* MERGEFORMAT } = { MERGEFIELD  T2  \* MERGEFORMAT } { MERGEFIELD  R1  \* MERGEFORMAT } { MERGEFIELD  R2  \* MERGEFORMAT } \* MERGEFORMAT }

If there is still issue, please provide us more information.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Mon Feb 13, 2017 6:57 am

Dear Dylan_Spire,

How is your issue now ?
Could you please give us some feedback at your convenience ?

Thanks,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Return to Spire.Doc