We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Compatibility Mode in Office365

I have tried this solution. It is not working for me.
Current version : 22.3.0
We have license for Aspose.Total for .NET

Whenever we produce any Word docx file we get a file which which we generally open in
Microsoft Word for Microsoft 365
We always get the Compatibility mode strip on the top:.
This is our current code. Please suggest code to fixt this:

CODE:

Document doc = new Document();
doc.CompatibilityOptions.OptimizeFor(Aspose.Words.Settings.MsWordVersion.Word2019);
//Begin Update doc sectio
//End Update doc section
using var ms = new MemoryStream();
var saveFormat = reportRequest.OutputFormat switch
{
    ProfileReportFormat.PDF => SaveFormat.Pdf,
    _ => SaveFormat.Docx,
};
///used  to solve compatibility mode issues
if (saveFormat == SaveFormat.Docx)
    Aspose.Words.Saving.OoxmlSaveOptions saveOptions = new Aspose.Words.Saving.OoxmlSaveOptions
    {
        Compliance = Aspose.Words.Saving.OoxmlCompliance.Iso29500_2008_Transitional,
        SaveFormat = saveFormat
    };

doc.Save(ms, saveOptions);

@leopius I have checked document generated by the following code in Office365 and MS Word 2019 and they do not show compatibility mode:

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.Write("Hello World");

doc.CompatibilityOptions.OptimizeFor(MsWordVersion.Word2019);
OoxmlSaveOptions saveOptions = new OoxmlSaveOptions
{
    Compliance = OoxmlCompliance.Iso29500_2008_Transitional,
    SaveFormat = SaveFormat.Docx
};

doc.Save(@"C:\Temp\out.docx", saveOptions);

Could you please create a simple document with Hello World text in your Office365 version and attach it here for testing? Also, please attach the document generated by Aspose.Words on your side. I will check the documents and provide you more information.