3.7.5.47 Page

Page object can be used to read and set the properties of graph, workbook and matrix window, There are page properties and page methods available, such as read how many sheets in workbook or how many layers in graph, find the sheet number with specified sheet name, activate the sheet with specified number or name, save the page as a file, etc.


Properties:

Page properties can be accessed using the following syntax:

  • page.property (numeric) or page.property$ (string) - for active window
  • windowShortName!page.property (numeric) or windowShortName!page.property$ - for specified window
  • rPage.property (numeric) or rPage.property$ (string) if rPage is range variable for page object

Note: Use page.=, windowShortName!page.= or rPage.= to view all available properties.

Property Applies To Access Description
page.aa graphs Read/write,
numeric
Anti-aliasing on or ff
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.activeonly graphs Read/write,
numeric
Show active layer only or not
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.canswitch graphs Read Return if page can switch. 0 = no, 1 = sheet, 2 = book
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.floating graphs,
workbooks,
matrices,
image,
layout
Read/write,
numeric
Control the window to float or retract

0 = retract the floating Window
1 = floating the window (to the first monitor)
2 = floating the window to the second monitor

page.fwom floating Window (graphs,
workbooks,
matrices,
image,
layout )
Read/write,
numeric
Control location of the Object Manager in the floating Window

0= hide the Object Manager
1/2/3/4/5 = setting the Object Manager to the Top/Left/Right/Bottom/Float position
10=If the Object Manager is hidden, it can activate its last set position

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.

Example below shows how to access metadata
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.

Beginning with Origin 2022b, a "long minus" is used, by default, in graphs made from System templates. For more information, see FAQ-992 How can I use a "real" minus sign to my axis tick labels?

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,
graph
Read/write,
numeric
used only in multi-page printing when printer setting might be different from one page to the next. It will apply to active sheet if window is worksheet or matrix, apply to graph window directly.

0 = auto (only workable for wks/mat)
1 = portrait
2 = landscape

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.ytitle Graphs Read/write,
numeric
Specify the offset of the Y axis title from the layer frame for all layers. For example, page.ytitle = 15 means 15%(layer frame width) from the layer frame.
page.zoom graphs,
workbooks,
matrices
Read/write,
numeric
Zoom the size of the window. It will do the same as Zoom combo at the Standard toolbar. For example page.zoom = 50 will set magnification zoom level to 50%. Or it can return zoom level in percent.
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 properties can be accessed using the following syntax:

  • page.method(argument) - for active window
  • windowShortName!method(argument) - for specified window
  • rPage.method(argument) if rPage is range variable for page object

Note: Use page.(), windowShortName!page.() or rPage.() to view all available methods of window

Method Description
page.copy([arg]) Copy the page if arg is not specified. For Workbook, Matrixbook and Note Window currently. If arg = "OLE", copy graph page as OLE.
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.GetDF(range) Retrieve the state of data filters in the active graph. State value see here. And range is a string variable to receive the worksheet range.
fname$ = System.path.program$ + "Samples\Statistics\automobile.dat";
newbook;
impASC;
worksheet -shdf uidShDF [[D:3:"between(16,23)"]]; //Define a Shared Data Filter
create myshdfvsy -vsshdf col(F) uidShDF; //Create virtual datasets using existing ShDF
plotxy iy:=(C,myshdfvsy) plot:=202;
page.GetDF(strrange$)=;//nn=2 and strrange$=[automobile]automobile
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.reverse([n]) page.reverse() or page.reverse(0) to reverse graph color in Dark Mode. page.reverse(1) to set graph color auto in Dark Mode.
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.
page.switch(sheetname$) Given a graph page contains data from more than one sheets, page.switch() change worksheet, and Plots in graph will all be switched to new sheet.

Examples:

Active a layer or sheet

Set Layer2 as the active layer in graph1

Graph1!page.active = 2;

Active Worksheet by sheet name

//Suppose current window is multi-sheet workbook with one sheet named "Raw Data";
page.active$ = "Raw Data" // Active the worksheet na,ed "Raw Data"

Note: Activate sheet doesn't active window. E.g. the following script create two workbooks. There are multiple sheets in an inactive workbook. Activating a sheet there will not bring that workbook to be the active window in project.

// Create a new workbook and save the book name to bkn$
newbook result:=bkn$;

// Add a new worksheet to bkn$, so there are 2 sheets and sheet2 is active
newsheet;

// Create another workbook. It will be the active window.
newbook;

// Make sheet1 in bkn$ active sheet. bkn$ book is still not the active window
bkn$!page.active = 1;

//The following script works for column A in active window, not bkn$
col(a) = {1:10};

Reorder Layers

Suppose there are two layers in Graph1. Layer1 is the left side layer, while layer2 is the right side layer. Run the following script:

Graph1!page.reorder(1,2);

The right side layer will become layer1, while left side layer will be layer2.

The reorder() method will not swap layer positions. To swap layer positions,

  • choose Graph: Layer Management... menu and go to Size/Position tab.
  • use the layswap X-Function.

Work with Window Names

page.name$ is a readonly property for page short name. To rename page short name, use the win -r command.

string winname$=page.name$; //page.name$ is ready-only
// Rename the short name of window with shortname winname$ as "Source"
win -r %(winname$) Source;

page.label$ and page.longname$ (old) are for page long name. It can be used to read or set the page long name/label.

page.label$ = "Temperature"; // Rename the long name to "Temperature"

To rename a window short name, use the win -r command.

page.title property controls how to display the window names, short name, long name, or both.

page.title = 3; // Show both short name and long name

Read and Set Number of Layers/Sheets

page.nlayers returns total number of sheets in workbook or layers in graph window.

page.active=page.nlayers; //activate last sheet/layer

Beginning with Origin 2018 SR0, the maximum number of sheets was increased to 1024 (OPJU project file format only). For workbook and matrix window, page.nlayers can be used as an easy way to add more sheets.

book1!page.nlayers=500; //faster than using repeat 500 {newsheet;}

Note: Set the number smaller than existing number of sheets or layers will do nothing. E.g. page.nlayers=1 will not remove the extra 499 sheets.

Save an Analysis Template

//build file name to be user files folder with window label name as file name
string fname$="%Y%(page.label$).ogwu"; 
string comments$ = "analysis template";

page.save(fname$,2,comments$); // save it as analysis template with data cleared

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
//add user variable to page/layer

//add: add storage
page.info.add(user);

//addsection: add section
page.info.user.addsection(variables);

//adddouble: add double variable
page.info.user.variables.adddouble(version, 4.12);

//addstring: add string variable
string str1="world";
page.info.user.variables.addstring(hello, "%(str1$)");

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.

Sheet Switching Browser Graph

page.switch("[book2]sheet");
page.switch("sheet"); //without book name means to use the same book
page.switch("[book2]");