我正在使用DocX library对我的文档进行后期处理。
有没有办法获得文档中所有方程的列表?
我已经看到您可以使用 oCompany = new SAPbobsCOM.Company();
oCompany.Server = "servername";
oCompany.language = SAPbobsCOM.BoSuppLangs.ln_Spanish_La;
oCompany.DbServerType = BoDataServerTypes.dst_MSSQL2008;
oCompany.LicenseServer = "localhost:30000";
oCompany.UseTrusted = false;
oCompany.DbUserName = "dbusername";
oCompany.DbPassword = "dbpassword";
oCompany.CompanyDB = "companyDB";
oCompany.UserName = "cusername";
oCompany.Password = "cpassword";
lRetCode = oCompany.Connect();
轻松插入等式,但我无法找到检索所有等式列表的方法。
答案 0 :(得分: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
,有助于识别它们。