Is there a way to compile such that the .docx document does not open in “compatibility mode”? (“phrase not found” in the manual, so I am guessing not.)
Answer: TBD
Is there way to compile so that the proofing language is e.g. UK English (not US English) – this is more important because correcting it can be non-trivial (don’t ask: some things in selections seem to prevent a proofing language change sticking, that’s all I know). NB dictionary in use at Options > Corrections > Spelling is English (United Kingdom-en-gb)
Answer: Yes!, use the MS Converter instead of Aspose, but note for me there were complaints about macros in a temp file and trying to resave normal.dot… cancelling out of all that the end result was a document in UK English. But… any way to avoid the extra macro etc. complications?
UPDATE: this is the macro dialog warning
I tried setting that as a trusted location in the Trust Centre, thusly
Too bad.
Microsoft waffles on about the documents created in an older version of Word; nothing about a DOCX created by a third-party app. When you do a conversion in Word — File > Info > Convert, it seems to adjust the margins, nothing else.
Looking at Compatibility Options, applying the highlighted settings make the macro/security warning go away.
My guess is that, the docx export is in 2013-21 “format” and that when the setting was “custom” (or, I also tested 2010 compatibility) some “conversion macro” is run.
Document still opens in word in Compatibility mode, but F12 to resave isn’t a big deal – getting rid of the interruption is
I’m on Insider version of everything Microsoft from Windows 11 to Office (think it’s sometimes still called that , who can say?).
I have the same experience. Scrivener saves to Word in Comparability Mode.
I don’t know what I’m doing differently, but my complied docx files do not open in compatibility mode. I’m working on Scrivener on the Mac, but opening the document in either PC or Mac versions of Word does not trigger compatibility mode.
UPDATE It’s more complicated than I thought. I am using an MS converter, not Aspose, BUT I have just noticed that the macro dialog issue has not gone away, it just depends on which compile format I use.
If I use the format that’s a copy of Modern, I get the warning. If I use a format derived from the built-in Proof format, I don’t.
I don’t know the differences, and TBH it doesn’t matter enough for me to pursue it further – I simply note the existence of differences in case that helps anyone else.
Maybe different aspose versions PC vs Mac hence slightly different code?
Would be interesting if L&L could state which MsWordOption is being set (but, I can imagine that setting a late version might cause the inverse problem for anyone using an earlier version of MS Office!)
Optimize a Document for a Particular Word Version
The optimize_for method allows optimizing document content, as well as default Aspose.Words behaviour for a particular version of Microsoft Word. You can use this method to prevent Microsoft Word from displaying the “Compatibility mode” ribbon upon document loading. Note that you may also need to set the compliance property to ISO29500_2008_TRANSITIONAL or higher.
The following code example shows how to optimize document content for Microsoft Word 2016:
# For complete examples and data files, please go to https://github.com/aspose-words/Aspose.Words-for-Python-via-.NET
doc = aw.Document(docs_base.my_dir + "Document.docx")|
doc.compatibility_options.optimize_for(aw.settings.MsWordVersion.WORD2016)|
doc.save(docs_base.artifacts_dir + "WorkingWithDocumentOptionsAndSettings.optimize_for_ms_word.docx")
I don’t know when this happened. But now every time I compile to docx, when I open the file in Word it’s in compatibility mode. It didn’t used to do this. I thought the Word normal.dotm was messed up. Deleted it and reopened word with a blank document to create a new normal.dotm. Then compiled again. It still opens in compatibility mode.
Could it be that while the file name has a DOCX extension, it actually is the old-format DOC binary file format? You can look at the contents of the file with a text editor.
This screen shot shows the binary gobbleygook of a DOC file; whereas a DOCX file is XML text and mostly recognisable in a text editor.
As to why the file extension might be wrong, I don’t know. Revisit your steps to create I guess.
Edit: I just changed the extension on a DOC file to DOCX and attempted to open in Word. Word complained and sent an error message saying that the format was wrong for the extension and refused to load. So my hypothesis is probably disproven.
@Julian_M1’s solution from Sep 2023 by which you tweak Word works but requires that you do this every time you produce a Compile in Word.
His GitHub extract is beyond my capability. I wouldn’t know where to start.
Mine is a copy of Manuscript (Times) which I tweaked years ago.
I ran a quick compile on a chapter extract using a copy of Modern and I still get Compatibility Mode in Word.
Word doesn’t store the setting “Compatibility for: All New Documents” and" Lay out this document as if created in: Microsoft Word 2013-2021".
But F12 - Save As does the trick without further fiddling.
I haven’t changed my compile format recently. I recompiled with one of Scrivener’s formats Manuscript Times and it opened in compatibility mode in Word also.
So, Scrivener is making a DOC format file but putting a DOCX extention on it. I can’t think why that would be. Re-check all your compile and export file name settings, I guess.
I tried it. Set the compatibility for All new documents, then saved it with F12. When I opened it, it was not in compatibility mode anymore but I got stray # signs throughout the Word. I know that means something in Scrivener when you import a doc to Scrivener. A separator of some sort, to split at the # and create a new text file when it imports.