Get cell value as a string
BOOL GetCell( int nRow, int nCol, string & strText )
BOOL GetCell( int nRow, int nCol, string & strName, TreeNode & tr )
TRUE for success, otherwise FALSE
FALSE if the specified cell dose not have associated XML tree, or there is error during retrival, TRUE for success
EX1
//Get the cell value as a string. int Worksheet_GetCell_Ex1() { WorksheetPage wp = Project.WorksheetPages(0); if(!wp) return -1; Worksheet wks(wp.GetName()); string strText; int iResult; wks.SetCell(0, 0, 3.14); iResult = (int) wks.GetCell(0, 0, strText); printf("Value at (0,0) location is %s\n", strText); return iResult; }
EX2
//Get a copy of the XML tree stored at the specified cell. int Worksheet_GetCell_Ex2() { Worksheet wks = Project.ActiveLayer(); Tree tr; int nR = 1, nC = 1; int iResult; string strName = "bogus"; wks.GetCell(nR, nC, strName, tr); out_tree(tr); // next we want to show that we can get the tree into a sub-branch tr.Junk.ID = 1; // adding a new branch called Junk // tr.Junk will be replaced, including the tagName, iResult = (int) wks.GetCell(nR, nC, strName, tr.Junk); out_tree(tr); return iResult; }
Get a copy of the XML tree stored at the specified cell.
If this function returns FALSE, then you can examine the strName to see if XML tree existed in cell or not. If function returns FALSE and strName is empty, then the cell does not have a tree. If XML tree existed but retrival failed, then function will also return FALSE but strName will not be empty, it will contain the name associated with the XML tree in the cell.
Datasheet::Cell,Datasheet::SetCell,Datasheet::TCell
origin.h