FRCMNS0
Forum Replies Created
Viewing 2 posts - 1 through 2 (of 2 total)
-
AuthorPosts
-
In this case, I am sure that MarkupSimplifier is modifying the styles.xml file. Here is the entire sample code used:
using DocumentFormat.OpenXml.Packaging; using OpenXmlPowerTools; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; namespace DocxTest { class Program { static void Main(string[] args) { try { File.Copy("PORTA.docx", "PORTA_copy.docx"); using (var docMaster = WordprocessingDocument.Open("PORTA_copy.docx", true)) { SimplifyMarkupSettings settings = new SimplifyMarkupSettings { NormalizeXml = true, // Merges Run's in a paragraph with similar formatting // Additional settings if required RemoveBookmarks = true, RemoveComments = true, RemoveGoBackBookmark = true, RemoveWebHidden = true, RemoveContentControls = true, RemoveEndAndFootNotes = true, //RemoveFieldCodes = true, RemoveLastRenderedPageBreak = true, RemovePermissions = true, RemoveProof = true, RemoveRsidInfo = true, RemoveSmartTags = true, RemoveSoftHyphens = true, }; MarkupSimplifier.SimplifyMarkup(docMaster, settings); docMaster.Save(); } Console.WriteLine("Done."); } catch(Exception ex) { Console.WriteLine("Error: {0}", ex.ToString()); } Console.ReadLine(); } } }
There’s nothing else being done to the document.
Most of the differences are a extra space before closing a tag or reordered attributes.The major change is right on the beginning of the file, mostly additional namespace declarations.
Here is a WinMerge report with the differences highlighted:
https://drive.google.com/file/d/0B0ZNalzpb4uFRjdndWFidTduME0/view?usp=sharingAs an addendum, the extra SimplifyMarkupSettings options (everything besides NormalizeXml) doesn’t cause errors, only when NormalizeXml is set this problem occurs.
-
AuthorPosts
Viewing 2 posts - 1 through 2 (of 2 total)