Document.UpdatePageLayout throwing exception when removing normal styles


I’ve got a specific document that throws an InvalidCastException when UpdatePageLayout is called after removing the normal styles. The .zip below is a distilled version of a larger service we have that combines files. We’re usually calling UpdatePageLayout after appending every document, but in this console app I’m only using one. A copy of the exception I see can be found in the Program.cs of the console app. It seems like a lot of it is obfuscated, so there’s not anything to get out of it.

I have seen this work fine with most other .docx documents we’ve tried, but can’t figure out why this one is having issues. The document(cover design 7.docx) is in the .zip.

Here’s a .zip containing a console app that reproduces the problem:

Thank you for any help you can offer,

  • Josh


Thanks for your inquiry. We tested the scenario and have managed to reproduce the same problem on our end. For the sake of correction, we have logged this problem in our issue tracking system. The ID of this issue is WORDSNET-17048. We will further look into the details of this problem and will keep you updated on the status of correction. We apologize for your inconvenience.

The issues you have found earlier (filed as WORDSNET-17048) have been fixed in this Aspose.Words for .NET 18.8 update and this Aspose.Words for Java 18.8 update.