c# - OpenXML: Read text between two document fields using OpenXML SDK -
i'm new programming openxml sdk , i've tried excessively locate , read text between 2 document fields, never succeeded. there tons of samples , tutorials on web can think of doing openxml sdk, setting watermarks doing merge mail, not 1 processing document fields.
my word document looks this:
{ field1 } data { field2 }
and want do, read data between field1
, field2
.
i succeeded point locate fields need this:
var qryfieldcode = (from p in procdoc.maindocumentpart.document.body.descendants() p.gettype() == typeof(fieldcode) select p).tolist();
but can read text between fields found?
any appreciated.
find first field (much above) , .elementsafterself.takewhile
until p.gettype()
doesn't = typeof(fieldcode)
. .value
of query , you'll have text. won't great solution if have things tables between 2 fields, example above, work.
Comments
Post a Comment