Find a matrix sheet by name.
VB: Function FindMatrixSheet(Name As ByVal String ) As MatrixSheet
C++: MatrixSheet FindMatrixSheet(LPCSTR Name )
C#: MatrixSheet FindMatrixSheet(string Name )
[<bookName>]<sheetName>
If the named matrix sheet is found then an Origin MatrixSheet is returned.
Private Sub SetMatrixSheetDimensions(sheetName As String, numRows As Integer, numCols As Integer) Dim app As Origin.ApplicationSI Set app = New Origin.ApplicationSI Dim msheet As Origin.MatrixSheet Set msheet = app.FindMatrixSheet(sheetName) If msheet Is Nothing Then MsgBox ("Failed to find matrix sheet") Exit Sub End If ' Put current dimensions in Excel sheet cells A1 and B1 Range("A1") = msheet.Rows ' put number of rows in Excel cell A1 Range("B1") = msheet.Cols ' put number of columns in Excel cell B1 msheet.Rows = numRows msheet.Cols = numCols ' Put new dimensions in Excel sheet cells A2 and B2 Range("A2") = msheet.Rows ' put number of rows in Excel cell A1 Range("B2") = msheet.Cols ' put number of columns in Excel cell B1 End Sub
using Origin; // allow using MatrixSheet without having to write Origin.MatrixSheet static void SetMatrixSheetDimensions(string strSheetName, int nRows, int nCols) { ApplicationSI app = new Origin.ApplicationSI(); MatrixSheet msheet = app.FindMatrixSheet(strSheetName); if( msheet == null ) { Console.WriteLine("Matrix sheet " + strSheetName + " not found."); return; } Console.WriteLine("Current dimensions of " + msheet.Name + " are " + msheet.Rows + " rows by " + msheet.Cols + " columns."); msheet.Rows = nRows; msheet.Cols = nCols; Console.WriteLine("New dimensions of " + msheet.Name + " are " + msheet.Rows + " rows by " + msheet.Cols + " columns."); Console.ReadKey(); }
import OriginExt as O app = O.Application(); app.Visible = app.MAINWND_SHOW pageName = app.CreatePage(app.OPT_MATRIX) layer = app.FindMatrixSheet(pageName) print(layer.Name)
8.0SR2
FindWorksheet