Free Support Forum - aspose.com

Static Date fields rendered incorrectly in PDF

I have a current date field in a Word document.

To prevent the field updating, I am using the FieldsHelper from the examples.

When using FieldsHelper to create static Date fields, the date is cut off.

Maybe I am not using the right FieldsHelper because another example in PHP refers to a class com.aspose.words.FieldsHelper, but i cannot find that. I am using Aspose Words for Java 16.4.0. I checked 18.6 but it does not seem to contain the class. Maybe i am missing a dependency?

I checked for a link that was present in other topics:
http://www.aspose.com/docs/display/wordsjava/How+to++Replace+Fields+with+Static+Text
But the link is broken.

And the value is not correct.

In Word it look like this:
word.PNG (1.8 KB)

By default the Aspose delivers this:
aspose-default.PNG (5.0 KB)

With the static helper from the example it look like this:
aspose-static-fieldshelper.PNG (4.3 KB)

I have tried to hack the fieldshelper to find a specific Run instance so i could set the field manually but the field is always cut off. It should read 12 januari 2015. When i hack in that string value, it leaves only the number 12.

I have even tried non-breaking unicode spaces, but that did not help. I do not know how to set the size of the Run object as i think it is rendered when saved. If i use a text without spaces, the full text is visible.

In the Node instances that fly by there are two Run instances. One with the 5 July value and one with the original value. Removing the “5 July” instance does not help. Is there some way to make the field non-linebreaking?

I have reviewed:


But nothing i found there helps.

I don’t know what to do to resolve this issue.

Hmm oh my god.

The PdfSaveOptions class has a setUpdateFields method.
That allows for the date field not to be updated.

saveOptions.setUpdateFields(false)

Thanks anyway.

@benzoid,

Thanks for your inquiry. It is nice to hear from you that you have found the solution of your query. Please feel free to ask if you have any question about Aspose.Words, we will be happy to help you.

Can you update your documentation to show that this FieldsHelper is no longer needed?

In your documentation you still refer to it:

$helper = new Java(“com.aspose.words.FieldsHelper”, $targetFieldType);

This is a non-existent class.

https://docs.aspose.com/display/wordsjava/Replace+Fields+With+Static+Text+in+PHP

@benzoid,

Thanks for your suggestion. We will remove FieldsHelper class from the documentation.