【发布时间】:2020-06-30 03:41:45
【问题描述】:
我想用表格替换一个字符串,我做不到。
下面是替换字符串的代码:
var newDoc = new FileInfo(OpenXml_docx);
File.Copy(sourceDoc.FullName, newDoc.FullName);
using (WordprocessingDocument wDoc = WordprocessingDocument.Open(newDoc.FullName, true)) {
XDocument xDoc = wDoc.MainDocumentPart.GetXDocument();
IEnumerable<XElement> content = xDoc.Descendants(W.p);
int count = OpenXmlRegex.Replace(content, findeDas, "#BlaBla", null);
Console.WriteLine("Example #1 Count: {0}", count);
wDoc.MainDocumentPart.PutXDocument();
}
我该怎么办?
【问题讨论】:
标签: c# openxml openxml-sdk openxml-powertools