GemBox Support Forum

Parsing field type - Unknown


When using the Fields collection on a loaded “.docx” file, it appears the parsing of the Field syntax is relatively strict when trying to identify the type. Per the documentation FieldType.Unknown value is returned when the InstructionInlines does not start with a Run with a valid field code.

As an example:

{ IF"SampleBookmark" > 0 “test” “test1” }

cannot be parsed correctly because there is no space between the IF and the first expression “SampleBookmark”. Whilst we always encourage our internal templates to be structured with the expressions correctly partitioned from the IF declaration, I don’t believe Microsoft is strict in enforcing this policy.

Whilst we can obviously change our templates to be better structured from a syntax perspective, I was wondering whether it would be possible to handle this type of scenario within GemBox.Document? This would save us having to go through an internal document review and sign off process purely to patch the internal documents we have that are afflicted by this problem.



This field parsing issue was resolved and the fix is now available in the latest publicly released bugfix version for GemBox.Document.
Visit our BugFixes page or NuGet.


1 Like