logo

Warning: The forum is now for consultation only. Please use GitHub Discussions to post any questions or comments.


Welcome Guest ! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Mandar  
#1 Posted : Monday, January 20, 2020 8:25:58 AM(UTC)
Mandar

Rank: Newbie

Groups: Registered
Joined: 12/26/2019(UTC)
Posts: 6
India
Location: Mumbai

If I want to get a value of particular cell then we use following script code
table[10, 2].DisplayValue

It is difficult to remember the column number.
Is there a way to use column name instead of column number?
Or Can I get column number if column name is provided.
epf  
#2 Posted : Monday, January 20, 2020 8:44:09 AM(UTC)
epf

Rank: Administration

Groups: Administrators
Joined: 12/20/2013(UTC)
Posts: 1,209
Switzerland

Thanks: 14 times
Was thanked: 206 time(s) in 199 post(s)
You can use (which use the first row of the table):

Code:
        
        /// <summary>
        /// Returns the column number from the element column name. -1 if not found.
        /// </summary>
        public int GetCol(string elementName)


or for display name, you can try:

Code:
var line = page.DataTable.Lines[0]; //For row 0
var col = Array.FindIndex(line, i =>  i.Element != null && i.Element.DisplayName == "column name");

Edited by user Monday, January 20, 2020 9:07:14 AM(UTC)  | Reason: Not specified

Users browsing this topic
Guest (2)
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.