ExcelSheet
Connects to the Excel sheet named lpcszSheetName.
Connects to the Excel sheet having the index nSheetNumber.
BOOL ExcelSheet( LPCSTR lpcszSheetName, int nColsNeeded = 0 )
string ExcelSheet( int nSheetNumber, int nColsNeeded = 0 )
Returns TRUE on successful exit and FALSE on failure.
Returns the name of the sheet on successful exit and an empty string on failure.
EX1
// For this example to run an Excel window with at least three sheets // must exist and be the active window in Origin. int WorksheetPage_ExcelSheet_ex1() { WorksheetPage wp = Project.ActiveLayer().GetPage(); if( !wp ) { out_str("Invalid page!"); return 0; } string strSheet = wp.ExcelSheet(2); BOOL bOK = wp.ExcelSheet(strSheet, 25); out_int("OK = ", bOK); Worksheet wks = wp.Layers(strSheet); if( !wks ) { out_str("Invalid sheet!"); return 0; } Column col = wks.Columns(24); if( !col ) { out_str("Invalid column!"); return 0; } Dataset ds(col); if( !ds ) { out_str("Invalid dataset!"); return 0; } ds.SetSize(100); ds = 1; ds[3] = 765.234; return 0; }
Connects to the Excel sheet having the index nSheetNumber and adds columns as needed so that there are at least nColsNeeded columns in the underlying Layer object.
WorksheetPage::OpenExcel
origin.h