The GetWorksheet method transfers data from specified Origin worksheet.
VB: Function GetWorksheet(Name As ByVal String, [ r1 As ByVal Object ], [ c1 As ByVal Object ], [ r2 As ByVal Object ], [ c2 As ByVal Object ], [ format As ByVal Object ] ) As Object
C++: _variant_t GetWorksheet(LPCSTR Name, _variant_t r1, _variant_t c1, _variant_t r2, _variant_t c2, _variant_t format )
C#: var GetWorksheet(string Name, var r1, var c1, var r2, var c2, var format )
Array as a variant. Actual array type is dependent on the format argument.
The Worksheet level GetData and the Application level GetWorksheet are going through the same code. This method is slower than the Column object GetData but it has the flexibility of getting a block of data from multiple columns.
Public Sub GetWorksheet() Dim app As Origin.ApplicationSI Dim data As Variant Set app = New Origin.ApplicationSI data = app.GetWorksheet("[Book1]Sheet1", 0, 0, -1, -1, ARRAY2D_VARIANT) If data Is Nothing Then MsgBox ("Failed to get worksheet") Else MsgBox ("get worksheet successfully") Range("A1") = data(0, 0) End If End Sub
static void GetWorksheet() { Origin.ApplicationSI app = new Origin.ApplicationSI(); object wksdata = app.GetWorksheet("[Book1]Sheet1", 0, 0, 3, 5, ARRAYDATAFORMAT.ARRAY2D_VARIANT); if (wksdata == null) { Console.WriteLine("Failed to get worksheet"); } else { Console.WriteLine("get worksheet successfully\n"); // You can cast wksdata as double[,] or byte[,] etc. for the data array of different types object[,] data = wksdata as object[,]; Console.WriteLine("data[1,1]=" + data[1,1] + "\n"); } Console.ReadLine(); }
import OriginExt as O app = O.Application(); app.Visible = app.MAINWND_SHOW pageName = app.CreatePage(app.OPT_WORKSHEET) testData = [[5,87,90], [3.14, 24.6, 68.09]] app.PutWorksheet(pageName, testData) outputData = app.GetWorksheet(pageName) print(outputData)
8.0SR2
PutWorksheet | Worksheet.SetData | Worksheet.GetData | Column.SetData | Column.GetData