【问题标题】:table finding from doc file using openxml使用 openxml 从 doc 文件中查找表
【发布时间】:2014-11-25 04:31:36
【问题描述】:

我想使用 c sharp 代码中的 openxml 包编辑 doc 文件中表格行中的值。在这里,我展示了查找表的代码,但它给了我 null,如果我使用 default 而不是 firstordefault,那么它会给我异常,比如序列不包含任何元素。

DocumentFormat.OpenXml.Wordprocessing.Table table=doc.MainDocumentPart.Document.Body.Elements<DocumentFormat.OpenXml.Wordprocessing.Table>().FirstOrDefault();

谢谢。

【问题讨论】:

    标签: c# openxml-sdk doc


    【解决方案1】:

    你可以使用这个: 表 table = doc.MainDocumentPart.Document.Descendants().FirstOrDefault();

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-02-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多