What I want:
I'm editing a WordprocessingDocument
, and adding some tracked changes in it. This part is done. Now, I want MS word to show all revisions by default, i.e., it shouldn't require user to click on the red side bar to open the tracked changes in the document.
What I did: For this, I found a class RevisionView
, which adds the xml element <w:revisionView />
in settings.xml
under w:settings
element. The RevisionView
has some properties like Comments
, DisplayRevision
, Formatting
etc. I explicitly set them all to true
.
RevisionView revView = new RevisionView();
revView.DisplayRevision = new OnOffValue(true);
revView.Formatting = new OnOffValue(true);
revView.InkAnnotations = new OnOffValue(true);
revView.Markup = new OnOffValue(true);
revView.Comments = new OnOffValue(true);
and then I added this revView
to the Settings
:
Settings settings = wordprocessingDocument.MainDocumentPart.DocumentSettingsPart.Settings;
settings.RemoveAllChildren<RevisionView>();
settings.AppendChild(revView);
settings.Save();
And then I reviewed the document xml explicitly, it is adding the following xml in the settings
:
<w:revisionView w:markup="true" w:comments="true" w:insDel="true" w:formatting="true" w:inkAnnotations="true" />
But adding this element in settings doesn't affect the view. It isn't showing the revisions opened by default.
Then, for testing purpose, I changed the zoom
element in the settings.xml
by hand from <w:zoom w:percent="100" />
to <w:zoom w:percent="120" />
. What I expected was: word would change the zoom for this document from 100
to 120
now. But it didn't do that, the zoom was 100
even after changing to 120
in settings.xml
.
One more thing: I can't use interop as I have to deploy this to a server, that's why I'm doing all this using OpenXmlSdk.
What I'm asking:
Is it even possible to do what i want?
If it is, then what am I doing wrong? Is
RevisionView
the option, on what should I rely?Is there a way to force word to apply (override the default application level settings) the settings provided in
settings.xml
?Why isn't word changing the zoom from 100 to 120?