Update Page Layout and Fields in Word Document C# .NET | Avoid System.NullReferenceException

Hi @netappcole, the probelm is resolved on your side? i have the same problem

@awais.hafeez , thanks for your response, please find in the attachement the the source
MyAsposeWords.zip (512.6 KB)
Visual Studio 2019

@taly,

Please ZIP and attach the following resources here for testing:

  • Your simplified source Word document you are getting this problem with
  • A standalone simple Console application (source code without compilation errors) that helps us to reproduce this exception on our end and attach it here for testing. Please do not include Aspose.Words DLL files in it to reduce the file size.

As soon as you get these pieces of information ready, we will start investigation into your scenario and provide you more information.

MyAsposeWords.zip (512.6 KB)
@awais.hafeez , please find the ZIP in attachment

@taly,

After an initial test with the licensed latest (21.4) version of Aspose.Words for .NET, we were unable to reproduce this issue on our end. Can you please upgrade to the latest version and see how it goes on your end? Do you see this problem when running this app in Docker container? Do you see this issue only when running over .NET 5?

1 Like

@awais.hafeez thanks for your feedback! no exception with the last version.

Before, with or without docker i have the problem.
My last problem is numeric alignement , please find the details
FONT_NUMERIC_NOT_ALIGNED.jpg (26.0 KB)

some numeric like 1 are down and some like 6 is up.(as you can see in attachment)
My environnement VS 2019 Windows WSL2 UBUNTU docker with alpine 3.12

@taly,

Please copy the latest versions of following font files from a Windows machine onto the machine where you are getting this problem during Word to PDF conversion and see how it goes?

  • Calibri
  • Symbol
  • Courier New

Do you see any missing fonts related warning messages? Please check the following articles:

1 Like

@awais.hafeez thank you so much! adding the following lines in the dockerfile (add ms font) :```
RUN apk --no-cache add msttcorefonts-installer fontconfig &&
update-ms-fonts &&
fc-cache -f

And some fonts are missing like Calibri…

@taly,

It is great that you were able to resolve fonts related problems on your end. Please let us know any time you may have any further queries in future.