Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am finding the Table and the Row from the Word document using Open XML, but getting errors specified the Bold part. Following is the Error getting while building the Application.

'System.Collections.Generic.IEnumerable<documentformat.openxml.wordprocessing.table>' does not contain a definition for 'First'

'System.Collections.Generic.IEnumerable<documentformat.openxml.wordprocessing.tablerow>' does not contain a definition for 'ElementAt'


// Find the first table in the document.
DocumentFormat.OpenXml.Wordprocessing.Table table =
doc.MainDocumentPart.Document.Body.Elements<documentformat.openxml.wordprocessing.table>().First();
// Find the second row in the table.
DocumentFormat.OpenXml.Wordprocessing.TableRow row = table.Elements<documentformat.openxml.wordprocessing.tablerow>().ElementAt(1);


Declared the following namespace also in the application

using DocumentFormat.OpenXml;
using DocumentFormat.OpenXml.Packaging;
using DocumentFormat.OpenXml.Wordprocessing;
using System.Xml.Linq;
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900