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 tags

the 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 that

once 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 sdk

in 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

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -