Worksoft Community

Counting the rows and columns in an HTML Table

Wiki Table of Contents

Page Details

First published by:
Yujira
on 5 Jan 2011
Last revision by:
Yujira
on 5 Jan 2011
1 person found this article useful.

100% of people found this useful
Counting the rows and columns in an HTML Table

Filed under: [Edit Tags]

 

To count the number of rows and columns in the HTML Table object:

Store the property named: rows.length (Step #1 in screenshot below).

Store the property named: cells.length (Step #2 in screenshot below).

The number of columns would then be cells.length/rows.length (Step #3 in screenshot below).

 

Note: on a standard web table the column header row is included in the rows.length

 

Recent Comments

By: Gary Posted on 27 Feb 2012 11:43

I'm having some problems making this work for Dynamic HTML.  I can find the table and save its context, but can't seem to get the appropriate row/cell count properties.  Is there some way to cast this against a generic table object to get that information?

Thanks in advance,

Gary

By: shashi_kn_soais Posted on 16 Apr 2012 9:28

Gary,

It is recommended to build the logic in Certify for a Dynamic HTML table if you cannot find a property which tells the number of rows.

Thanks and Regards,

Shashidar

©2009-2011 Worksoft, Inc.
Powered by Community Server (Non-Commercial Edition), by Telligent Systems