3.7.5.47 PagePage-obj
Page object can be used to read/control the properties of graph, workbook and matrix window. For example, we can active a worksheet or a graph layer by page.active property. Or using the page.nlayers property, we can either know how many layers in a graph window, or the number of sheets in a workbook. For more details, you can see examples below.
Properties:Page Property
Page properties can be accessed using the following syntax:
- [winName!]page.property =
winName! Is optional. If winName! Is not specified, the active window is affected.
Property
|
Applies To
|
Access
|
Description
|
page.active
|
graphs, workbooks, matrices
|
Read/write, numeric
|
Active layer number.
|
page.active$
|
workbooks, matrices
|
Read/write, string
|
Active layer name.
|
page.activeDataIndicator
|
workbooks, matrices
|
Read/write, numeric
|
Show the box in legend to indicate active data plot.
|
page.ali
|
graphs
|
Read/Write, numeric
|
Show/Hide Active Layer Indicator. 1 = Show; 0 = Hide.
|
page.autoSize
|
graphs
|
Read/write, numeric
|
Controls automatic layer resize when auto rotation of tick labels is turned on.
0 = (default) auto determine layer size when these 3 conditions are true.
1 = always auto resize layers
2 = never auto resize layers
|
page.banner
|
graphs
|
Read/write, numeric
|
Toggles the non-exporting/non-printing Speed Mode Banner on or off.
0 = Banner hidden.
1 = Banner displayed.
|
page.barShowZero
|
graphs
|
Read/write, numeric
|
Decide whether to show bar/column when the bar width/column height is 0:
-1 = auto, will follow setting of Bar graph show Zero Value in Preference: Options dialog,
0 = do not show bar/column when width/height = 0,
1 = will show bar/column even when the width/height = 0.
|
page.barWidthNoMissing
|
graphs
|
Read/write, numeric
|
When the Z value is missing for an XY pair, ignore missing data for column/bar width.
0 = disable Ignore Missing Data for Column/Bar Width.
1 = (default) enable Ignore Missing Data for Column/Bar Width.
See Notes for 3D Bar Graph.
|
page.baseColor
|
graphs, workbooks, matrices
|
Read/write, numeric
|
Page color. Numbers from the color list: transparent (0). The color() function can be used, as in: page.basecolor = color(blue);
|
page.breaktype
|
graphs
|
Read/write, numeric
|
When there is any axis break in the graph, set page.breaktype = 1 to keep the line trend(real line slope) before and after axis break as if there is no axis break. It is the script access for the option Keep Line Trend as if no Axis Break in the Display tab of Plot Details dialog.
|
page.cd
|
graphs
|
Read/write
|
Common Display settings. See also: The Page.cd object properties
|
page.closeBits
|
graphs
|
Read/write, numeric
|
Window closing behavior: 0 = normal, 1 = window will not close, and 2 = no warning message on window close.
|
page.cntrl
|
graphs, matrices
|
Read/write, numeric
|
For Graphs, controls drawing of overlapping layers: 0 = show data that extends into another layer (default) 4 = draw layers sequentially, thus hiding underlying data. This would, for instance, prevent underlying data from showing through an inset graph. 16 = ignore system theme. This would prevent the system theme from overriding template settings.
For Matrices, controls view mode: 0 = Data view mode 1 = Image view mode 2 = Show X/Y coordinates
|
page.cntrlColor
|
graphs
|
Read/write, numeric
|
When the control region is displayed (page.cntrlregion = 1), then page.cntrlcolor sets and reads the color of the control region using the numbers from the color list. Set page.cntrlcolor = 18 to display the control region using the graph window margin color (gray area).
|
page.cntrlHeight
|
graphs
|
Read/write, numeric
|
Set the height of the control region (if you want to display the control region at the top of the page).
|
page.cntrlRegion
|
graphs
|
Read/write, numeric
|
Set page.cntrlregion = 1 to display a control region. A control region provides a convenient location for placing tools. Set page.contrlregion = 0 to disable the display.
|
page.cntrlWidth
|
graphs
|
Read/write, numeric
|
Set the width of the control region (if you want to display the control region at the left of the page).
|
page.comments$
|
graphs, workbooks, matrices
|
Read/write, string
|
Page-level comments.
|
page.columnOffset
|
graphs, workbooks matrices
|
Read/write, numeric
|
Determines whether plot color is mapped to column index or column name. 0 = relate color map by column index. 1 (default) = relate color map by column name. Prior to Origin 2016, plot color was mapped only to column index.
|
page.connect
|
graphs
|
Read/write, numeric
|
Connect missing values in line data plots: 0 = disable, 1 = enable.
|
page.cp
|
workbooks matrices
|
Read/write
|
Control Pane settings. See also: The Page.cp object properties
|
page.cropmark
|
graphs
|
Read/write, numeric
|
Print cropmarks
|
page.customheight
|
graphs
|
Read/write, numeric
|
Custom Height in printing, used only in multi-page printing when printer setting might be different from one graph to the next.
|
page.customwidth
|
graphs
|
Read/write, numeric
|
Custom Width in printing, used only in multi-page printing when printer setting might be different from one graph to the next.
|
page.df
|
graphs
|
Read only, numeric
|
Wether the graph page has filter(s) or not. Return -1 if not a graph window.
|
page.dvHeight
|
graphs
|
Read only, numeric
|
When page.viewPaper = 0 (viewpaper off), page.dvheight = pixel height of the page (white area). When page.viewPaper = 1 (viewpaper on), page.dvheight will be reduced by 2*page.dvtop. The property value changes as the window is resized.
|
page.dvLeft
|
graphs
|
Read only, numeric
|
When page.viewPaper = 0 (viewpaper off), page.dvleft = 0. When page.viewPaper = 1 (viewpaper on), page.dvleft = 12. The property value changes as the window is resized.
|
page.dvTop
|
graphs
|
Read only, numeric
|
When page.viewPaper = 0 (viewpaper off), page.dvtop = 0. When page.viewPaper = 1 (viewpaper on), page.dvtop = 9. The property value changes as the window is resized.
|
page.dvWidth
|
graphs
|
Read only, numeric
|
When page.viewPaper = 0 (viewpaper off), page.dvwidth = pixel width of the page (white area). When page.viewPaper = 1 (viewpaper on), page.dvwidth will be reduced by 2*page.dvleft. The property value changes as the window is resized.
|
page.emo
|
graphs
|
Read/write,, numeric
|
page.emo = 0 to remove the margin offset. Note: Set it to anything other than zero will do nothing.
|
page.extInfo
|
workbooks
|
Read only, numeric
|
Type of active worksheet window: 0 = Origin worksheet, 1 = Workbook of Excel 2003 and older versions (*.xls), and 2 = Workbook of Excel 2007 and later versions (*.xlsx).
|
page.filename$, page.filepath$
|
workbooks, matrices
|
Read/write, string
|
Once a window is saved as ogw,ogg or external Excel book, these properties allow access to the file name.
|
page.gradColor
|
graphs, workbooks
|
Read/write, numeric
|
When displaying the page with a gradient fill, page.gradColor determines the gradient color. Use numbers from the color list: transparent (0). The color() function can be used, as in: page.gradcolor = color(blue);
|
page.height
|
graphs
|
Read/write, numeric
|
Page height in dots. Height in inches can be calculated, using the resolution in dots-per-inch, page.resy (below), from [page.height/page.resy].
|
page.imgauto
|
images
|
Read/write, numeric
|
Whether to allow linked image inserted to Graph to update when the source image is modified.
- 0 = default value. When a graph contains a linked image, a download button shows on the graph when you open the project to let you reimport the linked image. If the image file is modified, you will need to reimport it to see the change.
- 1 = show a download button on the image window if the image file is modified.
- 2 = automatically re-import if the image file is modified.
|
page.icons
|
graphs
|
Read/write, numeric
|
Layer icons: 1 = show, 0 = hide.
|
page.info
|
graphs, workbooks, matrices
|
Read/write, tree
|
Page storage object. Typically contains metadata associated with the last imported file (such as file date, name, path and etc.), and variables extracted from the file with Import Wizard.
The type of information stored will vary by window type and user specifications. For instance, two commonly-encountered page.info sections are SYSTEM.FORMULA (system variables v1 -v4 used for storing numeric and string values in the page) and SYSTEM.IMPORT (system variables used to store import file details in the page).
Note that SYSTEM variables differ from USER variables in that SYSTEM variables cannot be created, deleted or renamed; only their values may change.
To access the data of User Tree, please use page.tree instead.
|
page.isEmbedded
|
graphs
|
Read only, numeric
|
It indicates whether the specified page (of image, graph, or sparkline) was popped from an embedded cell, or not: 1 = embedded, 0 = non-embedded.
|
page.isEmbedded$
|
graphs
|
Read only, string
|
It holds the source cell range of an embedded page.
|
page.label$
|
graphs, workbooks, matrices
|
Read/write, string
|
For versions before 8.0, this is used to access a label to a window. long name should be used instead. To display the long name as the window title, set page.title = 1. (Note: You can also define and display a window label using the win -rl windowName "labelContents" command.)
|
page.layoutCntrl
|
graphs
|
Read/write, numeric
|
The Speed mode and View mode of all graph windows are controlled by the layout page window, if one exists: 1 = enable, 0 = disable.
|
page.layoutSpeed
|
layout pages
|
Read/write, numeric
|
The Show Picture Placeholders mode causes graph or worksheet pictures in the layout page window to be displayed as named, cross-hatched boxes: 1 = enable, 0 = disable.
|
page.LNexp$
|
workbook
|
Read only, string
|
Holder Book Long Name. Returns the Long Name of container workbook for embedded Graph, Matrix, Notes or HTML Report.
|
page.lock
|
graph
|
Read/write, numeric
|
Show or hide recalculation lock icons in the graph window: 1 = show, 0 = hide.
|
page.longminus
|
graph
|
Read/write, numeric
|
Page-level control of minus and multiplication symbols in tick labels: 0(default) = controlled by font, 1 = use of a "long minus" and multiplication symbol that generally improves display of ticks set to display in Scientific and Engineering notation.
|
page.longname$
|
workbooks, matrices
|
Read/write, string
|
Page-level long name.
|
page.mask
|
graphs
|
Read/write, numeric
|
Page-level mask override of global mask: 0 = hide masked points, 1 = show masked points, 2 = auto (default) follows global setting. Note that plot-level masking takes precedence over page-level masking (plot > page > global).
|
page.master
|
graphs
|
Read/write, numeric
|
Control of Use Master Items:
0 = disable
1 = enable for export only
2 = enable for screen, but it will be ignored if bit 1 not set
3 = enable for both export and screen
|
page.maxPts
|
graphs
|
Read/write, numeric
|
Speed mode for worksheet data plots. Maximum number of data points to display for each column based data plot in the layer, for screen display only. Printing and export will not use speed mode. To turn off speed mode for worksheet data plots, set this to 0. Please note that it is old and kept for compatibility, and we recommend to use layer.maxpts instead.
|
page.name$
|
graphs, workbooks
|
Read only, string
|
Short name
|
page.nLayers
|
graphs, workbooks, matrices
|
Read (graphs, workbooks, matrices)/write (workbooks, matrices) numeric
|
Number of layers on the page. From Origin 2018 SR0, page.nLayers is writable for workbooks and matrices, and can be used for adding sheets to the book (see example below).
|
page.nLinks
|
graphs
|
Read only, numeric
|
Total number of child layers on the page.
|
page.noClick
|
graphs, workbooks, matrices
|
Read/write, numeric
|
Disable mouse clicking on various objects: 1 = on axes and column headings, 2 = on data plots and cells, 4 = on labels, 8 = on objects, 16 = on layer frames, and 32 = on tick labels. Values are cumulative, so page.noclick = 5 disables clicking on axes and labels.
|
page.order
|
graphs
|
Read/write, numeric
|
Slide Index
|
page.orientation
|
workbooks, matrices
|
Read/write, numeric
|
0 for portrait, 1 for landscape, used only in multi-page printing when printer setting might be different from one graph to the next.
|
page.outsiderangespecpaint
|
workbooks
|
Read/write, numeric
|
Control of background shading of unused worksheet cells: 0 = disable, 1 = enable.
|
page.resx
|
graphs, workbooks, matrices
|
Read/write, numeric
|
Horizontal resolution in dots-per-inch.
|
page.resy
|
graphs, workbooks, matrices
|
Read/write, numeric
|
Vertical resolution in dots-per-inch.
|
page.rtMaxPts
|
graphs
|
Read/write, numeric
|
Independent real-time calculation of maxpts: 0 = disable and use maxpts.
|
page.SaveWks
|
graphs
|
Read/write, numeric
|
Control whether to save whole source workbook's data when saving OGG/OLE object: 0 = Auto, the saving status bit is not set yet 1 = Save Whole Source Workbook's data, the controlling bit is also saved and cannot be modified 2 = Save Only data related to current plot, the controlling bit is also saved and cannot be modified.
|
page.sysWin
|
graphs, workbooks, matrices
|
Read/write, numeric
|
Set the window as a system window which remains open when the project is closed: 1 = enable, 0 = disable.
|
page.title
|
graphs, workbooks, matrices
|
Read/write, numeric
|
Control the display of window title to show short name or long name or both: 1 = long name, 2 or 0 = short name, 3 = short name -long name.
|
page.tkey$
|
workbooks matrices
|
Read/write, string
|
Use to save a template key (string) into a user-defined template. For instance, you could use it to specify names of Python packages required for use of a custom workbook or matrixbook template. With the template active, type the following in the Script Window prior to saving the template.
page.tkey$ = "py:pandas"; // specify required package
page.tkey$ = "py:pandas scipy numpy"; // specify multiple packages
Upon loading the template, the property is read and the user is prompted to install any missing packages. Property can also be used to return name(s) of packages required by the active template.
|
page.tree
|
graphs, workbooks, matrices
|
Read/write, tree
|
Page storage object. The page.tree area is a storage area used to holds the user-defined information by a tree structure, e.g. the user can add some configuration info for use in the template.
To access the metadata associated with original file, please use page.info instead.
|
page.triangulationnormalizedata
|
graphs (XYZ contour/surface)
|
Read/write, bool
|
Normalize data for XYZ contour and XYZ surface plots (=1). Default, (0) = plot raw XYZ data. See Normalize Data for XYZ Contour/Surface Plot.
|
page.unit
|
graphs
|
Read/write, numeric
|
Page measurement units, as on the Print/Dimensions tab of the page's Plot Details dialog box: 1 = inch, 2 = cm, 3 = mm, 4 = pixel, and 5 = point.
|
page.updatetoprinter
|
graphs
|
Read/write, numeric
|
Specify whether to set page dimension according to active printer dimension.
- 0 - Never check printer in loading templates, i.e. page dimension will always be loaded from template as it is.
- 1 - Default. Will check the resolution of the current template. If template resolution < 600 DPI (or the modified default value in origin.ini), then page dimension will be updated to fit the dimension of printer of 600 DPI resolution; while if template resolution >= 600 DPI, page dimension will not be modified (same as 0)
- 2 - Always check the current active printer and update the page dimension to printer resolution.
|
page.viewmode
|
graphs
|
Read/write, numeric
|
Page view mode, as on the Miscellaneous tab of the page's Plot Details dialog box: 1=Print View, 2=Page View, 3=Old Window View (DO NOT USE), 4=Draft View, and 5=Window View.
|
page.viewPaper
|
graphs
|
Read/write, numeric
|
Page is surrounded by background color: 1 = enable, 0 = disable. The background color can be set with the system.ExtBackColor property.
|
page.width
|
graphs
|
Read/write, numeric
|
Page width in dots. Width in inches can be found from [page.width/page.resx]
|
page.win
|
graphs, workbooks, matrices
|
Read, numeric
|
Page state: 0=hidden, icon shown as hidden in PE; 1=window hidden, icon shown as normal in PE; 2=minimized; 3=normal; 4=maximized
|
page.xlcolname
|
Workbook
|
Read/write, numeric
|
Specify whether turn on Excel-like column Short Name restriction: 1=turn on; 0= turn off.
|
page.zoomIn
|
graphs
|
write, numeric
|
To zoom in the desired zoom location in the graph window. Note: If page.zoomIn = 0 , you will zoom in the graph to the ceter of the graph window; if page.zoomIn = 1 , you need to click to select the desired zoome location after you execute this script. This is actually a method, not property, so you could not read its value.
|
page.zoomOut
|
graphs
|
write, numeric
|
To zoom out the desired zoom location in the graph window. Note: This is actually a method, not property, so you could not read its value, but you need to assign it values before executing it, for example page.zoomOut = 1 .
|
page.zoomWhole
|
graphs
|
write, numeric
|
To restore page to 100% view. Note: This is actually a method, not property, so you could not read its value, but you need to assign it values before executing it, for example page.zoomWhole = 1 .
|
page.zoomLayer
|
graphs
|
write, numeric
|
To zoom in/out the grapy layer. Note: This is actually a method, not property, so you could not read its value, but you need to assign it values before executing it, for example page.zoomLayer= 1 .
|
Methods:Page Method
To run the object methods, use the following script:
- [winName!]page.method(argument)
Method
|
Description
|
page.copy()
|
Copy the page. For Workbook, Matrixbook and Note Window currently.
|
page.cp.add(1 12 DataNavigator:DC)
|
Add the Data Navigator panel to the left side of the active workbook. Workbook to be used with a Data Connector.
|
page.dimUpdate()
|
Update the active graph window to the printer setup mode.
|
page.findLayer(cIndex)
|
Returns the layer number (start from one) of the cIndexth (zero-basic) created layer. If the cIndex is not a valid creation index, return 0. Note: The creation index of the active layer can be gotten by layer.cindex.
|
page.getFileName(A)
|
Get the window label or, if there is no label, the window name into %A. If the active window has a page.label (whether displayed or not), then the label is returned in the specified string variable. Otherwise, the window name is returned.
|
page.layerNumber(layerName)
|
Returns the layer number of the LayerName layer. Returns 0 if LayerName is not a valid name. Useful when working with Excel workbooks with multiple sheets. Note: The active layer's name is stored in the object property layer.name$.
|
page.reorder(n[, m])
|
Layer number change. If m is not specified, change current layer to nth position. Otherwise, change nth layer to be the mth layer. Caution: If your graph includes linked layers, you should only change parent layer numbers. Origin may still break links during the reordering process.
|
page.save(fname$[, n, comments$])
|
Save the workbook or analysis template to path = fname$. Optionally, specify n = 0 (default) to save book; n = 1 to 4 for saving analysis template with n > 1 for no operation input and clear data: 2 = clear imported data, 3 = clear data in active sheet, 4 = clear data in all sheets.
|
Examples:
Active Page Layer
This script uses the active property to set layer 2 in the Graph1 window as the active layerlayer, active.
Graph1!page.active = 2;
Active WorksheetActive Worksheet
Page.active property can also activate a worksheet. Such as:
page.active = 2; // Active the 2nd worksheet
page.active$ = "Raw Data" // Active the worksheet named "Raw Data"
Note: When specifying a window's name in page.active property, it just sets the layer or worksheet in the window as the active worksheet, but not the active window. The below example demonstrates how this happens.
// Create a new workbook and save the name to bkn$
newbook result:=bkn$;
// Add a new worksheet to bkn$, now there are two worksheets
// and sheet2 is active worksheet
newsheet;
// Create another workbook, now the active window is the new one
newbook;
// Make sheet1 in bkn$ active
bkn$!page.active = 1;
// Since the second workbook is active window,
// data will be filled in new workbook, not bkn$
col(a) = {1:10};
Reorder Layers
This script uses the reorder() method to change layer 1 to layer 2. Layer 2 will move up a position to layer 1. Use the Edit: Add & Arrange Layers menu command to physically move the positions.
Graph1!page.reorder(1,2);
Work with Window Names
The page.title property controls how to display the window names, short name, long name, or both. And you can use page.label$ to get or set window's long name.
page.label$ = "Temperature"; // Rename the long name to "Temperature"
page.title = 3; // Show both short name and long name
Although there is a page.name$, this property is read only, so you can just get the window's name by this property. To rename a windowRename Window, use the win -r command.
string wn$ = page.name$; // Get the window name
win -r %(wn$) Source; // Rename the window name to Source
Know the Number of Layers/Worksheets
Page.nlayers returns the number of layers on a graph, or the number of worksheets in a workbook, and even the number of matrixsheets in a matrix window. This script loops over each layer in the active graph window and types the layer number to the Script window.
Loop (num,1,page.nlayers)
//loop from 1 to the # of layers in the page
{
type "layer number $(num)";
};
And you can use a similar way to get the number of worksheets in a book.
book1!page.nlayers=;
Adding Sheets to Workbooks or Matrices
Beginning with Origin 2018 SR0, the maximum number of sheets was increased to 1024 (OPJU project file format only).
Adding many sheets at once using repeat can be very slow.
repeat 500 { newsheet; }
To facilitate adding large numbers of sheets to a book, the LabTalk property page.nlayers was made writable, as for example:
page.nlayers = 500 // this is faster than repeat
Save an Analysis Template
string fname$=%YsensorData.ogwu;
string comments$ = "analysis template for import and analysis of sensor data";
page.save(fname$,2,comments$); // clear imported data
Accessing Metadata Stored in Workbook
//Import a file to workbook and activate it before execute the scripts below
//Dump the contents stored in page.info area
page.info.=;
//Dump the basic information of imported file
page.info.system.= ;
//Dump the variables extracted from imported file if existed
page.info.user.= ;
//Get the value of variables from the tree
string strName$ = page.info.system.import.filename$;
string strDate$ = page.info.system.import.filedate$;
type “File: %(strName$), Date: %(strDate$)”
// clear storage, <DEL> can delete single value, single section or the whole storage
page.info.Spacing=<DEL>; /// whole storage
For more examples, please see this page.
Adding User Tree to Workbook
// Activate the workbook before execute the scripts below
//Add a branch named “sample1” to User Tree
page.tree.sample1.name$ = "Jack";
page.tree.sample1.gender$ = "Male";
page.tree.sample1.age = 23;
//Add a branch named “sample2” to User Tree
page.tree.sample2.name$ = "Lucy";
page.tree.sample2.gender$ = "Female"
page.tree.sample2.age = 28;
// Dump the contents of User Tree
page.tree.=
/*
Output:
SAMPLE1
+---NAME = Jack
+---GENDER = Male
\---AGE = 23
SAMPLE2
+---NAME = Lucy
+---GENDER = Female
\---AGE = 28
*/
For more examples, please see this page.
|