c# - Write and read hidden tags in .docx documents using .Net -
c# - Write and read hidden tags in .docx documents using .Net -
what able write hidden marks in document, when user fills in information, can process each part of document according marks or sections surrounded it. i'm using .net, ideas? thanks
take @ sdtelements tag, openxml sdk , word 2007 content command toolkit
the essence is:
create word document template in word, turn on developer tab in developer tab there controls group. click "aa" ones insert new content tag, click "properties" edit tag alias , data, turn on design mode see content tagsthe steps below apply if app can output xml bind document:
open word content command toolkit open document created attach xml in right-side panel double-click on content tags edit xpath binding or utilize drag-drop; see wcct manual thatonce have template prepared, depending on actual task @ hand can many things these content tags, including:
replace custom xml part in document update info users see when open it use openxml sdk replace info without opening in word use template collect info (possible unreliable, not recommended) delete , insert content tags code via openxml sdkin code can find content tags using linq queries on openxmlsdk objects so:
var contenttags = document.maindocumentpart.document.body .descendants<sdtelement>() .where(x => x.sdtproperties.getfirstchild<tag>() != null && x.sdtproperties.getfirstchild<databinding>() != null) .select(x => x.sdtproperties.getfirstchild<tag>().val.innertext =="whatever tag you're looking or other status match several") .tolist();
c# .net vb.net docx
Comments
Post a Comment