Setting compatibilityMode to specific values

Hi,

I’m working on moving over document generation from a legacy engine to one that is using Aspose.Words. I have encountered a couple of issues with layout (images not being scaled/cropped properly, table cells being resized), and comparing the unzipped docs it seems that the legacy engine is using an additional compatSetting that I’m not sure how to set with Aspose. I’m specifically talking about word\settings.xml, where in the w:compat section I want to add:

<w:compatSetting w:name="compatibilityMode" w:uri="http://schemas.microsoft.com/office/word" w:val="11"/>

Could you please advise me on how I can achieve that using Aspose.Words?

Thanks,
Tomek

@acturisaspose You can use CompatibilityOptions.OptimizeFor method and passing the appropriate MsWordVersion to instruct Aspose.Words to set the required compatibility options in the document.

Hi,

I’ve tried using it, and as per [MS-DOCX]: compatibilityMode | Microsoft Learn I would expect the OptimizeFor() with MsWordVersion 2000,2002 and 2003 to set the compatibilityMode to 11, bot they don’t seem to do that, changing the other options instead. I am specifically looking to change this one specific entry - it looks like most of the settings that are changed by OptimizeFor can be adjusted one by one with changing other properties in CompatibilityOptions, so I’m not concerned if these are changed, and just looking for that one specific entry.

Thanks,
Tomek

@acturisaspose CompatibilityOptions.OptimizeFor method sets a set of compatibility options, which are required to make the document to look as if it is opened in the MS Word version the document is optimized for. Could you please attach your problematic documents (both generated by Aspose.Words and by your legacy system) here for testing? We will check them and provide you more information.