i have a document which contains some <w:pict>
tags in table. how i can read/get it using openxml or XDocument i want to Remove and then Add updated <w:pict>
tag in the document
我有一个包含一些
<w:tr w:rsidR="007F23F0" w:rsidTr="00773840">
<w:tc>
<w:tcPr>
<w:tcW w:w="4395" w:type="dxa" />
</w:tcPr>
<w:p w:rsidR="007F23F0" w:rsidP="00855D6B" w:rsidRDefault="007F23F0">
<w:r>
<w:t>Approver Signature:</w:t>
</w:r>
<w:fldSimple w:instr=" DOCPROPERTY A1_Sign \* MERGEFORMAT ">
<w:r w:rsidR="00773840">
<w:t>A1_Sign</w:t>
</w:r>
</w:fldSimple>
<w:r w:rsidR="00773840">
<w:pict>
<v:shape id="_x0000_i1026" style="width:127.5pt;height:47.25pt" filled="t" o:preferrelative="f" type="#_x0000_t75" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:v="urn:schemas-microsoft-com:vml">
<v:imagedata r:id="rId7" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" />
<o:lock v:ext="edit" aspectratio="f" />
</v:shape>
</w:pict>
</w:r>
</w:p>
<w:p w:rsidR="007F23F0" w:rsidP="00855D6B" w:rsidRDefault="007F23F0" />
<w:p w:rsidR="007F23F0" w:rsidP="00855D6B" w:rsidRDefault="007F23F0" />
</w:tc>
</w:tr>
1 个解决方案
#1
0
using (WordprocessingDocument document = WordprocessingDocument.Open(fileName, false))
{
var run = document.MainDocumentPart.Document.Descendants<Run>().ToList();
foreach (var eachrun in run)
{
var pic = eachrun.Descendants<Picture>().ToList();
foreach (var eachshape in pic)
{
--your code---
}
}
}
#1
0
using (WordprocessingDocument document = WordprocessingDocument.Open(fileName, false))
{
var run = document.MainDocumentPart.Document.Descendants<Run>().ToList();
foreach (var eachrun in run)
{
var pic = eachrun.Descendants<Picture>().ToList();
foreach (var eachshape in pic)
{
--your code---
}
}
}