Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files from any .NET platform (C#, VB.NET, ASP.NET, .NET Core) and Java applications (J2SE and J2EE) with fast and high quality performance.

Tue Jan 11, 2011 6:47 am

Hello,
Once I got a Word document from my friend, there are some tables in it. I want to know how many cells are there in these tables. To get the information, how can I traverse the cells of a table in Word document?
Can you offer me any advices?
THANKS!

moonsky
 
Posts: 9
Joined: Mon Dec 13, 2010 7:39 am

Wed Jan 12, 2011 3:39 am

Thank you for your inquiry.
You can use Spire.DOC to accomplish it:
//Get the table object
Spire.Doc.ITable table = section.Tables[0];
//Loop through all rows:
foreach (TableRow row in tableRows)
{
//Loop through all cells
foreach (TableCell cell in tableCells)
{
//do something...
}
}
e-iceblue support
User avatar

iceblue support
 
Posts: 240
Joined: Tue Dec 21, 2010 2:56 am

Return to Spire.Doc