Hi Aspose Support,
Recently we faced with the issue when for some images in DOCX document scale becomes to big. This happens when re-save document using Aspose.Words.dll and use CompatibilityOptions to optimize document -> doc.CompatibilityOptions.OptimizeFor(MsWordVersion.Word2013);
Checked on latest version 19.8.
Documents example:
Documents.zip (1.9 MB)
Example_ConvertedResult.DOCX - file after conversion with the scaled image
Code example:
private static void ConvertWord(string inputFile, string outputFile, string openPassword)
{
Aspose.Words.Document doc = new Aspose.Words.Document(inputFile,
new Aspose.Words.LoadOptions()
{
Password = !string.IsNullOrEmpty(openPassword) ? openPassword : null
});
doc.Unprotect();
if (File.Exists(outputFile))
File.Delete(outputFile);
doc.CompatibilityOptions.OptimizeFor(MsWordVersion.Word2013);
Aspose.Words.Saving.OoxmlSaveOptions saveOptions = new Aspose.Words.Saving.OoxmlSaveOptions(Aspose.Words.SaveFormat.Docx);
saveOptions.Compliance = Aspose.Words.Saving.OoxmlCompliance.Iso29500_2008_Transitional;
doc.Save(outputFile, saveOptions);
}
Please help with this problem.
Thanks.
@licenses
Please use the OoxmlCompliance as Iso29500_2008_Strict to get the correct output.
Aspose.Words.Saving.OoxmlSaveOptions saveOptions = new Aspose.Words.Saving.OoxmlSaveOptions(Aspose.Words.SaveFormat.Docx);
saveOptions.Compliance = OoxmlCompliance.Iso29500_2008_Strict;
doc.Save(MyDir + "output.docx", saveOptions);
Yes, it works with strict compliance, but what to do if we need transitional?
@licenses
We suggest you please do not use CompatibilityOptions.OptimizeFor method. Could you please share MS Word version that you are using to view the document?
Hi @tahir.manzoor,
Please see Word version:
WordVersion.png (2.4 KB)
We suggest you please do not use CompatibilityOptions.OptimizeFor method.
Unfortunately, that’s not a solution. If you have this feature in API, I suppose it should work correctly and do not modify scaling.
Even so, what exactly changes (except, probably, schemes) in document’s XML when OptimizeFor is used?
CompatibilityOptions.OptimizeFor | Aspose.Words for .NET
Thanks in advance for the response.
@licenses
You are saving Word document with Word 2013 compatibility and viewing it in Office 365. In your case, the OoxmlCompliance should be Iso29500_2008_Strict.
We have logged this problem in our issue tracking system as WORDSNET-19075. You will be notified via this forum thread once this issue is resolved.
We apologize for your inconvenience.
The issues you have found earlier (filed as WORDSNET-19075) have been fixed in this update.
Confirm the fix. All works as expected with v19.9.
Thanks.