2.14.1.13 template_saveas

Brief Information

Save a graph, workbook or matrix window as a template

Command Line Usage

template_saveas pg:=[Graph1] category:="My Templates" template:="OffsetY" filepath:="C:\My Templates" emf:=0 bmp:=1;

X-Function Execution Options

Please refer to the page for additional option switches when accessing the x-function from script

Variables

Display
Name
Variable
Name
I/O
and
Type
Default
Value
Description
Page pg

Input

Page

<active>
Specify the page which will be saved as tempalte. The active page is used by default if no page is specified.
Category category

Input

string

<auto>
Specify the template's category name.
Template Name template

Input

string

<auto>
Specify the template name. Default is ORIGIN.
File Type ftype

Input

int

0
Specify the file type. When save the Graph template, default file type is OTPU. When save the Workbook template, default file type is OTWU. When save the Matrix template, default file type is OTMU.

Option list:

  • 0=a: OTPU / OTWU/ OTMU
  • 1=b: OTP / OTW / OTM
Template Description desc

Input

string

<unassigned>
This is used to add description about the template.
Template Type savetemplate

Input

string

<active>
Specify template type. It is set automatically according to the specified page. Which are Workbook Template (*.otw), Graph Template (*.otp) and Matrix Template (*.otm) respectively. Note that it is invisible in GUI.
Preset Graph Short Name sname

Input

string

<auto>
Preset Short Name for graph created from this template. It is only available for graph window.
Preset Graph Long Name lname

Input

string

<auto>
Preset Long Name for graph created from this template. It is only available for graph window.
Mark as Cloneable Template clone

Input

TreeNode

<unassigned>
Specify whether the template is cloneable. It is only available for graph window.
Match Modifiers by matchModifiers

Input

string

<unassigned>
Some plot attributes can be modified by mapping them to a column of values. The mapped column can be identified by its relative column index number (Offset) or by column Short Name, Long Name, Units, Comments, (built-in) Parameter(n) or User-defined Parameter.
File Path filepath

Input

string

<auto>
Specify the template file path. The default path is the User Files Folder. Note that the path should be exist, or the script gives an error.
Preview Image (Optional) preview

Input

string

<unassigned>
When you save a graph or workbook template, a preview image of the window is automatically generated. Graph previews are used in the Plot menu (Templates category) and Template Library. Workbook previews are used in the New Workbook dialog.

Option list: 0=...File:[*.bmp;*.jpg;*.png]*.bmp;*.jpg;*.png

EMF File emf

Input

int

1
Specify whether or not to save an EMF image file for the template preview. This check box is available when saving a graph template.
Bitmap bmp

Input

int

0
Specify whether or not to save a Bitmap image file for the template preview. This check box is available when saving a graph template.
Allow System Theme & System Increment Lists to Override loadsys

Input

int

<auto>
Specify whether or not to allow system theme upon loading to override the template settings. This check box is available when saving a graph window.

Option List:

  • 0=false
  • 1=true
Dialog Hint asksave

Input

int

1
Dialog hint, for display only. Give a notice that if the Allow System Theme to Override check box is checked, the template settings can be overridden by the system theme upon loading. This string is shown on the dialog when the Allow System Theme to Override is checked for the first time.

Description

This X-function is used to save a graph/workbook/matrix window to a template. There are different settings for saving these three windows to a template. And the dialog is different according to the specified page.

Examples

  1. Open the project: <Origin Program Directory>\Samples\Graphing\OffsetY.opj.
  2. Activate Graph1 and run template_saveas -d; in Command Window. In the pop-up dialog, specifies settings as below to save the template named OffsetY in My Template category.

    Template saveas example 1.png

  3. Click the OK button to save this page as a template. The template is shown as follow.

    Template saveas example 2.png