126.96.36.199.5 Other Options
Syntax: worksheet -b winName [TemplateName]
Get the first worksheet that begins with winName.
- If the named window can be found, TemplateName will be ignored.
- If the TemplateName is omitted, winName will be regarded as template name too.
- If the named window cannot be found, look for a template file called TemplateName and open that.
- If no template file is found, open ORIGIN.OTW.
- If ORIGIN.OTW is not found, create a window from scratch, name it winName, and enumerate it.
//Create three workbooks named "Book1", "Test1" and "Test2", active "Test1"
worksheet -b book1; //Workbook book1 is activated.
worksheet -b t; //Workbook Test1 is activated.
worksheet -b AA; //A new workbook named "AA" is created and activated.
Syntax: worksheet -cdf
In the active worksheet, clean up the format settings with the whole worksheet or entire column(s).
Note that this command does not clear the format settings for individual worksheet cell(s).
Syntax: worksheet -cof
In the active worksheet, convert non-SCN (spreadsheet cell notation) column formula into SCN. It will turn on SCN if it's not.
Note that this command only converts the formula but does not execute it.
Syntax: worksheet -crr
Clear the old banded row format (by filling cell background color) in table (worksheet table or intermediate table inserted in Graph window).
Note: in case formats of an intermediate table mess up after clearing, you can set @WEF = 1 to open the Edit Formatting dialog (right click on the table window title bar) to reset it.
Syntax: worksheet -e dialogbox
Open the specified worksheet dialogbox.Values for dialogbox are listed below.
|Note: For Format, a column must be selected. Use the wks.colSel() object method.
ASCII -- ASCII Import Options for Datan dialog box.
DisplayControl -- Worksheet Display Control dialog box.
Format -- Worksheet Column Format dialog box (first select a column).
Par -- Import Verification dialog box.
Script -- Worksheet Script dialog box. If the user clicks on the Do It button, i is set to 1. If the user clicks on the Update button, i is set to 0.
worksheet -e script; //Open Worksheet Script Dialog
//Type the following script into the dialog
// worksheet -c;
//Press "Update" button
worksheet -dr Test; //A new workbook named "Test" is created and has three columns
Syntax: worksheet -es
Reset worksheet range selection behavior when selection fails:
Occasionally, for reasons not fully understood, range selection in the worksheet becomes disabled. The user is not able to highlight a column by double-clicking on a column header nor is the user able to select a range of cells in the worksheet. Opening the Script Window (Window: Script Window) and running the following command with the problem worksheet active, should correct the problem and restore correct selection behavior.
Beginning with Origin 2018b, this command runs on loading a previously-saved window or project, and should prevent the problem from occurring.
Syntax: worksheet -fp
Toggle frozen panes set by GUI or by wks.frozen$.
work -fp; // toggle frozen panes on
work -fp 0; // toggle frozen panes off
Syntax: worksheet -frd
Fix duplicates in the active sheet:
All the duplicates except the one whose name matches the column in which it is located get new empty datasets
-gd pb; Custom Page Breaks
Syntax: worksheet -gb pb -i/m(r/c) rowcol [rowcol2]
Custom Page Breaks:
Must first set worksheet to view page breaks from the View menu, or using the script wo -q 1
//must first enable page break from View menu
//to add a custom break, insert -ir -ic
wo -gd pb -ir 12;//insert at row 12
//to move a break at known location
wo -gd pb -mr 12 14;//move from row 12 to row 14
Syntax: worksheet -q n
Turn on/off view page breaks for the current worksheet.
wo -q 1;//show page breaks
wo -q 0;//hide page breaks
Syntax: worksheet -r
Run the script in the Worksheet Script dialog box:
With a workbook active, press F4 key to open Worksheets Properties dialog. Switch to the Script tab and enter the following script command in the edit box:
worksheet -a 3;
Press OK to close the dialog and save the script. Now go to the script window and type:
The worksheet script will execute, and three columns will be added to the worksheet.
Syntax: worksheet -rf columns
Repair Set Values formula for the worksheet column:
Projects with many Set Values operations sometimes develop problems. This command can re-establish correct input and restore such things as missing operations locks.
work -rf *; //repair formula for all
work -rf G; //repair formula for col(G)
Syntax: worksheet -rr
With a report sheet active, run this command to recover the ranges with empty UID data reference in report sheets
Syntax: worksheet -rri
With a report sheet active, run this command to recover the ranges with empty UID data reference in report sheets, plus recover also the inputs of operations whose output is found in the same sheet (it is not always reliable because it involves some guessing).
Syntax: worksheet -s c1 r1 c2 r2
Set the specified range to be the current worksheet selection. To select entire columns, set r1 and r2 to zero. To select entire rows, set c1 and c2 to zero. If range is not specified, deselect all.
The next script sets the selection range in the data1 worksheet and plots this data into the scatter graph template. The script then sets a new selection range in the worksheet and plots the data into a second graph window.
win -a data1; //activate data1
worksheet -s 2 0 2 0; //select column 2
worksheet -p 201 scatter; //plot into scatter template
win -a data1; //re-activate data1
worksheet -s 3 0 3 0; //select column 3
worksheet -p 201 scatter; //plot into scatter template
Syntax: worksheet -scf [FILTERSTYLE]
Clear specified cell formats FILTERSTYLE of the selected range(s). If no FILTERSTYLE is specified, all formats will be cleared. The FILTERSTYLE list can be found in oc_const.h flie (which locates in <exe folder>/OriginC/system/). The number indexes from 0. For example, index of fill color (OFST_Interior) is 6 and font (OFST_Font) is 8. Multiple FILTERSTYLE separate by space.
work -scf 6 8; // clear fill color and font
Syntax: worksheet -sl c1 r1 c2 r2
Select a range of label row cells. If range is not specified, clear the current selection.
worksheet -sl 0 1 0 1; // select first label row
worksheet -sl 1 1 3 3; // select label row c1,r1 to c3,r3
worksheet -sl // clear the current selection
Syntax: worksheet -sou db
Delete worksheet rows above the selected row and move current row to the top (i.e. set it as row 1).
Syntax: worksheet -sou extend
Extend current selection of cell(s) to the last of the column.
Syntax: worksheet -sou mr n
Move current selected row(s) up or down n rows. Mowv down when n > 0; while move up when n < 0.
work -sou mr 1; //move down to next row
work -sou mr -1; //move up to last row