c# - PowerTools for Xml Corrupts Document when using NormalizeXML -
i normalizing docx document using normalizexml function xml powertools 2.2 code:
simplifymarkupsettings settings = new simplifymarkupsettings{ normalizexml = true, };
my goal search , replace variables, variables not in same "run property" , result not replaced. not want disable proofing in office.
after running program docx file corrupt , complains styles when try open (and normalizexml function did not work or finish):
the xml data invalid according schema. part:/word/styles.xml,line 1, column 0
i using openxml 2.0 since openxml 2.5 needs .net 4.5
i'm using office 2013.
when use openxml 2.0 productivity tool picks error this:
error node type : styles error part : /word/styles/xml error node path : /w:styles1 description : ignorable attribute invalid - value 'w14 w15' contains invalid prefix not defined.
here see when open styles.xml :
<?xml version="1.0" encoding="utf-8"?><w:styles mc:ignorable="w14 w15" xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingcanvas" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officedocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officedocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingdrawing" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingdrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessinggroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingink" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingshape">
i keep documents compatible between office 2007/2010/2013.
at stage considering searching "mc:ignorable="w14 w15" attribute , doing empty replace there must better way this.
thanks advice.
my temporary solution make sure variables (and characters used detect variable example : #name#) in document needs replaced of same font "run properties" don't broken up.
i using editix make sure variable in 1 "run property", not ideal want users add own variables later.
Comments
Post a Comment