Assign Text with Empty or NULL Values to Bookmark in Word Document using SET REF Fields in C# .NET

Hi,

at the moment i am testing SET-fields (for defining bookmark values) in word documents.

I think, we have found an error while updating SET-fields in a document.A SET-field that is initialized with an empty value is not valid after using function updateFields() anymore.
It seems that this bookmark is lost and all REF-fields that are based on a SET-field with an empty value will not work anymore.
–> Error! Reference source not found.

This handling of SET-fields differs from Microsoft Word!

Example:
Word document with following content:
{ SET myBookmark “” }Value:[{ REF myBookmark }]

Result after updating in Microsoft Word (e.g. pressing F9):
Value:[]

Result after calling updateFields() per Aspose:
Value:[Error! Reference source not found.]
(Note: After pressing F9 in Word, the bookmark is valid again)

This problem occurs with Aspose 10.5.0 and we rate this as very critical error, because our customers can not use their document templates anymore.

Do you have a workaround for this problem? Is there any way to avoid invalid/deleted bookmarks?

By the way same problem occurs with document variables. After setting an empty
value for a document variable, this document variable is not available
anymore.

Thanks a lot.

Best regards
Matthias

See attachements:
TestUpdateSetFields.doc - Original document with SET-field myBookmark before saving and updating of fields)
TestUpdateSetFields SavedbyAspose.doc - After updating and saving document per Aspose

Hello
Thank you for reporting this problem to us and for the additional information. I managed to reproduce the problem on my side. Your request has been linked to the appropriate issue. You will be notified as soon as it is fixed.
Best regards,

Hi Andrey,

thanks for your answer. Do you know if there is any workaround for this problem? Is there any way to avoid invalid/deleted bookmarks?

Thanks a lot.

Best regards
Matthias

Hello
Thanks for your inquiry. The simple way to work this problem around is inserting white space instead of empty string before update fields:
{SET myBookmark " "}
Best regards,

Hi Andrey,

thanks for your answer. Setting blank value works fine but our customers do have thousands of document templates that uses if clauses where bookmarks are compared with an empty value.

e.g. { IF {REF myBookmark} = “” “empty” “notEmpty” }

Therefore a conversion of all templates is not possible for us.

Best regards
Matthias

Hello
Thank you for additional information. Currently I cannot suggest you any way to work this problem around. You should just wait for the fix of the original issue.
Best regards,

Hi,

We will try to fix this issue in the next release (end of December or beginning of January). I’ll proceed to issue analysis shortly.

Thanks.

Perfect!

Thanks a lot.

Best regards
Matthias

The issues you have found earlier (filed as WORDSNET-5605) have been fixed in this .NET update and this Java update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.