FieldType.FieldFormula and Field Brackets

Hi there,

this code:
            WField field = (WField)paragraph.AppendField(@"{ = { PAGE } - { PAGEREF  test234 } }", FieldType.FieldFormula);

does not lead to a working field.
The brackets are recognized by Word only as curly/curvy brackets, but not as "field function brackets" which in Word directly one would insert using Ctrl-F9.


Please advise, I cannot find anything in the documentation.



1 Reply

MJ Mohanaselvam Jothi Syncfusion Team October 11, 2017 01:42 PM UTC

Hi Alexander,

Thank you for using Syncfusion product.

On further analyzing with the given code example, we suspect your requirement is to get the page number by evaluating the expression using PAGE field and PAGEREF field resultant values. To meet your requirement in Microsoft Word, you have inserted the fields(PAGE ad PAGEREF) one by one(using Ctrl+F9). To achieve the same in DocIO, each field should be inserted one by one.

We have prepared a sample to meet your requirement. In this sample, we have done the following things:
1. Create Expression field.
2. Insert Page field within Expression field.
3. Insert "-" operator as WTextRange next to Page field.
4. Insert PageRef field next to Text range

Please do find the sample from following link and let us know if this helps you.
http://www.syncfusion.com/downloads/support/forum/133134/ze/Sample-1934237003.zip

Please find the below UG documentation link to know more about working with Fields using Essential DocIO:
https://help.syncfusion.com/file-formats/docio/working-with-fields

Please let us know if you have any other questions.

Regards,
Mohanaselvam J
 


Loader.
Up arrow icon