java.lang.IllegalStateException: Inaccessible because font is defined by theme font

I have a requirement to parse a docx template and replace all the tokens in the input template. but at the time of saving after replacement of all tokens ,its failing at

document.save(“D://output_doc.docx”,SaveFormat.DOCX);

And getting below exception logs:

Caused by: java.lang.IllegalStateException: Inaccessible because font is defined by theme font.
at com.aspose.words.zzWY.getName(Unknown Source)
at com.aspose.words.zzYYA.getNameOther(Unknown Source)
at com.aspose.words.Inline.zzZiy(Unknown Source)
at com.aspose.words.zz6T.zzY(Unknown Source)
at com.aspose.words.zz7Q.visitRun(Unknown Source)
at com.aspose.words.Run.accept(Unknown Source)
at com.aspose.words.CompositeNode.acceptChildren(Unknown Source)
at com.aspose.words.CompositeNode.acceptCore(Unknown Source)
at com.aspose.words.Paragraph.accept(Unknown Source)
at com.aspose.words.CompositeNode.acceptChildren(Unknown Source)
at com.aspose.words.CompositeNode.acceptCore(Unknown Source)
at com.aspose.words.Body.accept(Unknown Source)
at com.aspose.words.zz7Q.zzV(Unknown Source)
at com.aspose.words.zz7R.zzZEG(Unknown Source)
at com.aspose.words.zz7R.zzZEH(Unknown Source)
at com.aspose.words.zz7Q.zzMw(Unknown Source)
at com.aspose.words.zz6F.zzZEG(Unknown Source)
at com.aspose.words.zz6F.zzZ(Unknown Source)
at com.aspose.words.zzZF1.zzZ(Unknown Source)
at com.aspose.words.Document.zzZ(Unknown Source)
at com.aspose.words.Document.zzZ(Unknown Source)
at com.aspose.words.Document.save(Unknown Source)
at com.aspose.words.Document.save(Unknown Source)

I am using Aspose word java , version 19.10. I tried with version 19.11 as well. but no luck.
I need a help ASAP…

Thank you…

@Pintutrnt

To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your input Word document.
  • Please create a simple java application ( source code without compilation errors ) that helps us to reproduce your problem on our end and attach it here for testing.

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

PS: To attach these resources, please zip and upload them.

I am not able to reproduce the issue in sample code but in my application code above mentioned exception is coming. For your reference, I am attaching the sample code and input document. Since its happening with my customer ,a quick response will be grateful…

SampleCode (7).zip (3.1 KB)
input.zip (26.4 KB)

@Pintutrnt

We have tested the scenario using the latest version of Aspose.Words for Java 19.11 with shared code and document. We have not found this issue at our end. Please make sure that you shared the same input document and code example for which you are facing this issue.

Please suggest your customer to try the latest version of Aspose.Words for Java 19.11. Hope this helps.

Yes, I have also tested with latest version of Aspose.Words for java version 19.11 but no luck, i am getting the same exception sometimes.

i have shared you the same input document but i can’t share the application code due security reasons. If you want , i can have WebEx call and share the screen.

Thank you…

@Pintutrnt

Unfortunately, it is difficult to say what the problem is without reproducing it. Please share the simplified code to reproduce this issue at our end. We will then log this issue in our issue tracking system for fix. Thanks for your cooperation.

is it possible please, because i can’t share my application code.

Thank you…

@Pintutrnt

Please note that we only provide support via forums. Please make sure that you are using the latest version of Aspose.Words for Java 19.11. Are you facing this issue at specific system or some other system also? Please also share if you face this issue with every document or with specific document.

Yes , I am using latest version of Aspose.Words for java 19.11.

I am facing in windows system as well as Linux system. Sometimes same document is working as expected but sometimes its throwing above mentioned exception.

@Pintutrnt

Unfortunately, we cannot log this issue for fix without reproducing this issue. Perhaps, there is some specific test case that throws this exception. Please check it at your end and share the code example to reproduce this issue. We will then log this issue in our issue tracking system. Thanks for your cooperation and understanding.