Sets a row of the worksheet to a label of the given type.
BOOL SetAsLabel( UINT nType, int index, BOOL bUndo = FALSE, BOOL bLabel = FALSE, BOOL bAppend = FALSE )
TRUE on success, FALSE on failure
EX1
// Create a worksheet, fill some rows with values then use data to fill Label header void Worksheet_SetAsLabel_Ex1() { Worksheet wks; wks.Create("origin.otw",CREATE_VISIBLE); if ( wks ) { vector<string> v1(5), v2(5); // Put some data into worksheet just to show how this works for(int ii = 0; ii < 5; ii++) { string strText; strText.Format("ROW %d:COL 1",ii); v1[ii] = strText; strText.Format("ROW %d:COL 2",ii); v2[ii] = strText; } DataRange drOut; drOut.Add("X", wks, 0, 0, -1, 0); drOut.Add("Y", wks, 0, 1, -1, 1); drOut.SetData(&v2, &v1); UINT nType; int nRet; nType = RCLT_LONG_NAME; nRet = wks.SetAsLabel(nType, 0, FALSE); // Replace LONG NAME label from text in Row 1 nType = RCLT_UNIT; nRet = wks.SetAsLabel(nType, 1, FALSE); // Replace UNIT label from text in Row 2 nType = RCLT_COMMENT; nRet = wks.SetAsLabel(nType, 2, FALSE); // Replace COMMENT label from text in Row 3 nType = RCLT_PARAM; nRet = wks.SetAsLabel(nType, 3, FALSE); // Replace PARAMETER label from text in Row 4 nType = RCLT_PARAM + 1; nRet = wks.SetAsLabel(nType, 4, FALSE); // Replace PARAMETER label from text in Row 5 } else out_str("No active worksheet"); return; }
EX2
// Worksheet should be active - pass 0..3, 0..MaxRow-1 int Worksheet_SetAsLabel_Ex2(UINT nType, int index, BOOL bUndo = FALSE, BOOL bLabel = FALSE, BOOL bAppend = FALSE, BOOL bDeleteRow = FALSE) { Worksheet wks = Project.ActiveLayer(); if(wks) return (int) wks.SetAsLabel(nType, index, bUndo, bLabel, bAppend, bDeleteRow); }
origin.h