0

我正在使用DocX 库对文档进行后处理。

有没有办法获取文档中所有方程的列表?

我已经看到您可以使用 轻松插入方程式DocX.InsertEquation(),但是我找不到检索所有方程式列表的方法。

4

1 回答 1

0

是的,可以使用以下 LINQ 表达式:

string mathNamespace = "http://schemas.openxmlformats.org/officeDocument/2006/math";
var equations = doc.Paragraphs.Where(
                    p => p.Xml.Descendants(XName.Get("oMathPara",mathNamespace)).Any());

所有方程式都包含在段落元素中,但它们还包含一个特殊的 XML 元素,称为oMathPara帮助识别它们。

于 2016-02-11T13:14:53.113 回答