The CreatePage method creates an Origin page of the specified type, such as a worksheet page or graph page.
VB: Function CreatePage(Type As ByVal Integer, [ Name As ByVal Object ], [ templateName As ByVal Object ], [ option As ByVal Object ] ) As String
C++: LPCSTR CreatePage(int Type, _variant_t Name, _variant_t templateName, _variant_t option )
C#: string CreatePage(int Type, var Name, var templateName, var option )
A string containing the name of the page created.
You can also use the Add method in the various page collections to create a new page. This method has the additional option for giving the name of the page.
Dim oApp As Origin.ApplicationSI Set oApp = GetObject("", "Origin.ApplicationSI") Const ORIGIN_WINTYPE_WKS = 2 Dim name As String, realname As String name = "MyWorksheet" realname = oApp.CreatePage(ORIGIN_WINTYPE_WKS, name, "Origin")
static void Main(string[] args) { Origin.IOApplication pOrigin; pOrigin = new Origin.ApplicationSIClass(); string strName = pOrigin.CreatePage((int)Origin.PAGETYPES.OPT_WORKSHEET, "OriginLab", "Origin", 2); //2 mean visible, create new workbook pOrigin.PageBases[strName].Activate(); //make it as active page }
import OriginExt as O app = O.Application(); app.Visible = app.MAINWND_SHOW grPageName = app.CreatePage(app.OPT_GRAPH)
import random import win32com.client # COM module # Connect to Origin origin = win32com.client.Dispatch("Origin.ApplicationSI") # Create a new workbook named "Python" using the "origin" template pageName = origin.CreatePage(2, "Python", "origin") # 2 for WorksheetPage # Generate X data to be the even numbers from zero to 100. # Note: the end of range is exclusive xData = range(0,101,2) # Generate Y data to be random numbers yData = [] for i in range(0,len(xData)): yData.append(random.random()) # Put the X and Y data into the worksheet origin.PutWorksheet(pageName, xData, 0, 0) # row 0, col 0 origin.PutWorksheet(pageName, yData, 0, 1) # row 0, col 1
8.0SR2