Field Formatting Inconsistency

A client has given us a document and the output is not consistent with Word. When printing or viewing the document from Word a field is updated as full caps. When using Aspose to save as PDF, it is mixed case.

I’m not knowledgeable enough to know which is correct however to maintain compatibility we’d prefer Aspose to match Word on this. Is it possible for someone to have a look at the file and let us know whether this is a bug? I cannot post the file publicly so please let me know the best way to provide it.

Hi Nicholas,

Thanks for your inquiry. Please attach your input Word document and output PDF file showing the undesired behavior here for testing. We will investigate the issue on our end and provide you more information.

Best regards,

Hi Awais
If I attach the file, can everyone see it? As I said it must remain confidential. Thanks.

Hi Nicholas,

Thanks for your inquiry. It is safe to attach files in the forum. If you attach your documents here, only you and Aspose staff members can download them. Also you can zip files and send it to my e-mail as described here:
https://forum.aspose.com/t/aspose-words-faq/2711
You can also remove any sensitive information by replacing it with dummy data instead.

Best regards,

Thanks Awais, I’m new here :slight_smile:
I have attached a zip of 3 documents. The original DOC file edited down to a few lines, a PDF produced by Word (using OLE in this case) and a PDF produced by Aspose.Words.
I’m not totally sure how the field works but it seems to be based on the value of the bookmark at the start of the page.
You can also see the difference in Word 2010. When I open the document and hit CTRL-P to print it previews as mixed case.

Hi Nicholas,

Thanks for your inquiry. This is not a bug. When you update fields using MS Word 2013, the output will be in mixed case. The same can be achieve using the following code:

Document doc = new Document(MyDir + @"field-case-change.doc");
doc.UpdateFields();
doc.Save(MyDir + @"out.pdf"); // or print it

If we can help you with anything else, please feel free to ask.

Best regards,

UpdateFields makes no difference to us in this case.
It seems to be that Word 2013 is different to Word 2010, which we are currently using. Aspose is acting like Word 2013 which may be more correct but will cause a change in output which needs to be managed.
Is there a compatibility mode to make it act like Word 2010?

Hi Nicholas,

Thanks for your inquiry. The CompatibilityOptions.OptimizeFor method allows to optimize the document contents as well as default Aspose.Words behavior to a particular versions of MS Word. You can use this method to prevent MS Word from displaying “Compatibility mode” ribbon upon document loading. I hope, this helps.

Best regards,

I tried a few versions like
doc.CompatibilityOptions.OptimizeFor(MsWordVersion.Word2007);
But it doesn’t seem to have helped. It’s still full caps in all cases. I don’t think it matters, we’ll ask if matching the newest version of Word is OK. Thanks for your help.

Hi Nicholas,

Thanks for your inquiry. We will test your scenario over Word 2010 and Word 2007 and get back to you soon.

Best regards,