3.7.5.102 Wks.Col


Columns in a worksheet or objects in a matrix are handled as objects in Origin. These objects can contain much information, such as column name, column numeric type, data formats, etc. The column attributes can be accessed and changed using the properties in the table below.

Properties

Property Type Access Description
wks.col.comment$ string Read/write Column Comment row header string value.
wks.col.categorical.sort numeric Read/Write Read or set the sort method for column n: 0 = unsorted, 1 = ascending, 2 = descending and 3 = customizable (arbitrary).
wks.col.categorical.type numeric Read/Write Read or set the type for column n
wks.col.cmap.palette$ string Read/Write Read or set the color palette for the matrix object.
wks.col.digitMode numeric Read/write Set the digit display mode: 0 = display all, 1 = set the decimal places, and 2 = set the significant digits.
wks.col.digits numeric Read/write Number of decimal places when wks.col.digitMode = 1, number of significant digits when wks.col.digitmode = 2: 0 = display all, n = display n.
wks.col.edit numeric Read/write Adds one of the following controls to each cell in the column: check box, list box, combobox
wks.col.evenx numeric Read/write Read or set column n to be using Sample Interval: 0 = not using Sample Interval, 1 = using Sample Interval with Internal X Initial value = 0 and Increment value = 1.
wks.col.filter
wks.col.filter$
numeric/string Read/write Add or remove a filter.
Set or get filter query string. It must set the filter type to advance.
wks.col.filterenabled numeric Read/write Enable or disable a filter. 1 = enable filter, and 0 = disable filter.
wks.col.filterprescript$ string Read/write Set or get before query script.
wks.col.filterx$ string Read/write Set and get the variable used to represent the column.
wks.col.format numeric Read/write Column format: 1 = Numeric, 2 = Text, 3 = Time, 4 = Date, 5 = Month, 6 = Day of Week, 7 = Text and Numeric, and 8 = Color as listed in the Format drop-down list in the Worksheet Column Format dialog box.
wks.col.formula$ string Read/write Column formula as in Set (Column) Values or in F(x)= label row (see also Column Label Row Characters).
wks.col.formularange$ string Read Column formula range as in Set (Column) Values.
wks.col.index numeric Read/write Column index counting from left to right. Use this property to reorder worksheet column.
wks.col.iscat numeric Read/write Read or set column is Categorical or not. 0 = Column type is not Categorical, 1 = Column type is Categorical.
wks.col.label$ string Read/write Column label access for versions before 8.0. Still supporte to control long name, units and comments in a single call.
wks.col.lname$ string Read/write String value for the long name of column or matrix object.
wks.col.missing numeric Read/write Custom missing value. This property allow setting custom missing value such that non-double columns can have missing value support.
wks.col.name$ string Read/write Column short name
wks.col.nCols numeric Read/write Number of columns for Matrix Object; for worksheet column, always 1.
wks.col.nRows numeric Read/write Number of rows
wks.col.numerictype numeric Read/write Column numeric type
wks.col.py$ string Read/write Contents of Python Formula tab in Set (Column) Values
wks.col.script$ string Read/write Contents of Before Formula Script tab in Set (Column) Values
wks.col.subformat numeric Read/write Subformat options as listed in the Display drop-down list of the Worksheet Column Format dialog box (select from main menu Format: Column ... to open this dialog).
wks.col.svrm numeric Read/write Set Value Recalculate Mode for the column formula (in any) of the column. 0=none,1=auto,2=manual.
wks.col.tWidth numeric Read/write The number of characters that can be entered in a Text column.
wks.col.type numeric Read/write Column type: 1 = Y, 2 = disregard, 3 = Y Error, 4 = X, 5 = Label, 6 = Z, and 7 = X Error.
wks.col.unit$ string Read/write Units row header
wks.col.width numeric Read/write Width of a single worksheet column (e.g. "col1"), in units of characters.
wks.col.xinit numeric Read/write Internal X Initial value for column. The XINIT, XINC and XUNITS appear in the Sampling Interval row header if displayed.
wks.col.xinc numeric Read/write Internal X Increment value for column.
wks.col.xuints$ string Read/write Internal X Units string for column.
wks.col.xname$ string Read/write Internal X Name string for column. The XNAME and XUNITS appear as the X Axis Title on plots of this column.

Methods

Method Description
wks.col.filter Open the filter dialog
wks.col.setformat Setformat method combines functionalities of the format and subformat methods, additionally allowing custom formats to be specified.
wks.col.setformula Set the column formula.
wks.col.findX Returns corresponding X column index

Examples

Worksheet Column Access

Active sheet column access by index

// Set col(1)'s short name in active sheet as "Time"
wks.col1.name$ = Time;

// You can reference another book, but the target sheet must still be active
// Set column 5 in the active sheet of Book5 to be an X column
Book5!wks.col5.type = 4;

// col0 to refer to last column
//set last column formula
wks.col0.formula$="A";

Set Custom Date Format

This script sets the format of column 2 of the active worksheet to a custom date format.

// Surround non-date characters in specifier by single quotes:
wks.col2.SetFormat(4, 22, yyyy'.'MM'.'dd);