We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

How to display dynamic data in header/footer

Hi,

In my project I am filling a word template file with some dynamic data.
As word doesn't allow to use form fields in header/footer, I used a little trick with STYLEREF to accomplish it.
Basically I have one or more hidden form fields in the body each with its own style, and in the header/footer I'm using STYLEREF in places where I need the data to be shown.
But, when filling the data with DocIO, this doesn't work, at least not automatically.

Is it possible to accomplish the same with DocIO?

Thx,
Igor

3 Replies

DV Divyalakshmi Vasudevan Syncfusion Team May 21, 2015 09:31 AM UTC


Hi Igor,

Thank you for using Syncfusion products.

In DocIO, text form field has been preserved with the following structure.

WTextFormField

|
FieldMarkSeparator -
|
FieldResult
|
FieldEnd

Essential DocIO internally adds FieldSeparator, FieldResult and FieldEnd while adding the TextFormField item to the paragraph. If you need to hide the TextFormField, then you need to set the hidden property as true for all the elements. So that you can able to hide the StyleRef field result also. We have prepared a sample to illustrate the same. Please find the sample from the below link


Sample Link:
http://www.syncfusion.com/downloads/support/forum/119189/GenerateWord_WPF-988345401.zip
In the input template document, we have inserted the StyleRef field with Heading1 style in header which refer the PersonName TextFormField with same Style in the body, fill the form field data and set the hidden property as true.


Please let us know in case of any other questions.

Regards,
Divyalakshmi V



IG Igor May 22, 2015 09:38 AM UTC

Hi Divyalakshm,

Thanks for your info and a sample, but it seems to me my question wasn't clear enough, sorry.
I have no problem with hiding form fields, my problem is that the data from the form fields isn't copied in their STYLEREF places in the footer.
What I am doing is:
1) Open a word template file
2) Fill the needed data in form fields and tables
3) Save the word file  (.doc)
4) Print the resulting file (using WordDocument.RenderAsImage)
6) Convert the file to PDF
7) Send the PDF to the customer

The problem is that my STYLEREF fields in the footer don't show any values ie. the values are not copied from the form fields with the same style.
On the print as well as in the PDF, there is no info which should be in the footer.
Is there something I need to do before saving the file, to apply the STYLEREFs?

Regards,
Igor


SK Sathish K Syncfusion Team May 25, 2015 10:52 AM UTC

Hi Igor,

Thank you for your update.

Currently DocIO doesn’t provide support for StyleRef field in Word document to Pdf and Image conversions. We have already logged this a feature request in our database. A support incident to track the status of this feature has been created under your account. Please log on to our support website to check for further updates

https://www.syncfusion.com/account/login?ReturnUrl=%2fsupport%2fdirecttrac%2fincidents

Please let me know if you have any questions.

Best,
Sathish




Loader.
Live Chat Icon For mobile
Up arrow icon