Page

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.

Contents

Properties:

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.baseColor graphs 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.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.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.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.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.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.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.icons graphs Read/write,
numeric
Layer icons: 1 = show, 0 = hide.
page.info graphs,
workbooks,
matrices
Read/write,
numeric, string
Page storage object. Typically contains import file information (file date, name, path, etc.), plus such things as Import Wizard extracted metadata, user variables stored in the page, user tree info, etc.

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 there is a general mechanism for adding USER sections (and variables) to the active page storage area. It should also be noted that SYSTEM variables differ from USER variables in that SYSTEM variables cannot be created, deleted or renamed; only their values may change.
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.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 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.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=Window View, and 4=Draft 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.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:

To run the object methods, use the following script:

[winName!]page.method(argument)
Method Description
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.

Examples:

Active Page Layer

This script uses the active property to set layer 2 in the Graph1 window as the active layer.

Graph1!page.active = 2;

Active 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 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 matrix sheets 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