Worksheet

Name

Worksheet

Remark

The Worksheet class provides methods and properties common to worksheet layers in Origin worksheet pages. An Origin worksheet may contain a number of worksheet columns thus the Worksheet class contains a collection of all the columns in the worksheet.

An Origin C Worksheet object is a wrapper object that is a reference to an internal Origin worksheet object. Origin C wrapper objects do not actually exist in Origin and merely refer to the internal Origin object. Consequently, multiple Origin C wrapper objects can refer to the same internal Origin object.

The Worksheet class is derived from the Datasheet, Layer, and OriginObject classes from which it inherits methods and properties.

Hierarchy

Examples

EX1

// Delete all the columns in the active worksheet.
int Worksheet_Worksheet_Ex1()
{
    Worksheet wks = Project.ActiveLayer();
    if(wks)
    {
        out_int("Number of columns to be deleted = ", wks.GetNumCols());
        // The following loop will continue until it fails to delete the first
        // column in the worksheet.  Each time the first column is deleted the
        // other columns are shifted left causing the second column to become
        // the first column.
        while(wks.DeleteCol(0));
    }
    else
        out_str("The active window is not a worksheet.");
    return 0;
}

EX2

// Access a specific sheet in a specific book
void Worksheet_Worksheet_Ex2()
{
    Worksheet wks("[Book2]Sheet3");
    if(wks)
    {
        int nR1, nR2;
        wks.GetBounds(nR1, 0, nR2, -1);// need to convert to LabTalk indexing by +1
            printf("Worksheet [%s]%s has %d rows of data\n", wks.GetPage().GetName(), wks.GetName(), nR2+1);
    }
    else
        out_str("No such sheet");
}

header to Include

origin.h

Reference

Members

Name Brief Example
AddCol Add a new column to the worksheet Examples
AppendRows Append rows to the worksheet Examples
AttachPicture Attaches a Image File to Worksheet cell Examples
AutoSizeRow Autosizing height of worksheet row, both for data rows and label rows Examples
CheckAddLabelByType Check if a label of the given type already exists among headers. If yes, it will just return its position. If not, it will be added and its position will be returned. Examples
ClearLabelsContent Clear content of a label of the given type. Examples
Columns Access the Columns collection by index Examples
CopyTo Copy data to another worksheet with optional row shift Examples
CreateCopy Create a copy of an existing worksheet Examples
CrossTab Do cross tabulation Examples
DeleteCol Delete a column in the worksheet Examples
DeleteRange Delete a range of data in the worksheet Examples
DeleteRow Delete a row in the worksheet Examples
DeleteRows Delete rows in the worksheet Examples
DeleteSelection Deletes the current selection from a worksheet.Deletes the current selection from a worksheet. Examples
DetachGraph Detach any graph that is attached to a given Worksheet cell Examples
EmbeddedPages Retrieves an embedded page by index Examples
EmbedGraph Attaches a graph to Worksheet cell Examples
EmbedMatrix Attaches a matrix to Worksheet cell Examples
EmbedNote Attaches a Note to Worksheet cell Examples
ExportASCII Export worksheet to an ASCII file Examples
Extract Extracts a Worksheet to a new or an existing worksheet Examples
ExtractOneGroup Vector extraction from a column with grouping information Examples
FindColIndex Starting from a given column index, find a column with the required designation. The column returned could be the first or last found, dependending on the options, and the search could go to the left or to the right. Examples
GetASCIMP Get the internal ASCII import settings for the worksheet. The settings will be returned in an ASCIMP structure. The ASCIMP structure is defined and documented in the oc_types.h header file. Examples
GetBounds Get the minimum beginning and maximum ending row indices for the specified columns in this Worksheet. Examples
GetCell Get cell value as a string Examples
GetCellComment Get cell comment as a string Examples
GetCellsWithNotes Get list of cells with Notes Examples
GetColDesignations Get the column designations for a worksheet in string form Examples
GetColFormats Gets the column formats of all the columns in the worksheet Examples
GetCurve Create a curve object based on two datasets Examples
GetEmbeddedGraphs Provides access to all embedded graphs Examples
GetEmbeddingParams Gets embedding parameters if there is an embedding at the cell identified by nRow, nCol and dwEmbedParams Examples
GetHideStatus Get all rows/columns hide status. Examples
GetLabelRow Provides Label row index for a given Label type ID Examples
GetLabelType Provides Label type ID for a given Label index Examples
GetNumEmbeddedPages Returns number of embedded pages. Examples
GetPrintArea Use to get the existing printing area. Pass NULL to test if printing area exist. Examples
GetRange Get the beginning and ending row indices for the specified columns in this Worksheet. This is an improved version of GetBounds with more detailed controls on handling of missing and text values Examples
GetScript Worksheet script getting Examples
GetSelectedColumns Fill a vector with column indexes where column is completely or partially selected Examples
GetSelectedRange Retrieves the current selection from the worksheet Examples
GetSelection Retrieves the current selection from the worksheet. Examples
HasEmbedding Checks if worksheet has any kind of embedding, graph, note, image etc. Examples
HideLabelByType Hides labels of the given type (if the label of that type is shown). Examples
InsertCol Insert an empty column in the worksheet with the given name and store the name in a string. If the given name already exists then increment it. The actual name created is returned by reference Examples
InsertRow Insert an empty row in the worksheet Examples
IsGridLinesShown Reveal if vertical (Column) or horizontal (Row) grid lines are being shown in a worksheet Examples
IsheaderShown Determine if Row or Column headers are shown Examples
IsHolderSheet Checks if worksheet is holder sheet Examples
IsLabelCategoryNamesShown Determines if Row header Labels are displayed or not Examples
IsLabelTypeShown Returns TRUE or FALSE depending on whether the label of the given type is shown or not. Examples
IsWriteProtected Check the worksheet's selected range whether has write protected column or not. Examples
LabelsMerge Get/Set label rows' dynamic merge state. Examples
MakeGroupEntriesAndRowMap Provides categorical information for the worksheet Examples
Open Open a new worksheet from the supplied OGW file and attaches it to the object. Examples
PasteData Paste specified, tab-delimited text into a worksheet Examples
PutRecordset Put data from a recordset into an Origin worksheet Examples
PutSPCBlob Put the data from an SPC blob into the worksheet. Examples
ReadRecordset Read data from a recordset into worksheet Examples
RemoveEmbedding Remove embeddings at a given Worksheet cell Examples
Reorder Reorder the rows of worksheet with specified orders Examples
ReorderColumns Reorder the columns of worksheet with specified orders Examples
RunFilter Run enable data filters in the worksheet Examples
SelectRows Select rows from worksheet based on a LabTalk condition expression Examples
SeparateLabel Extract target label from source label row. Examples
SetASCIMP Set the internal ASCII import settings for the worksheet. The settings will be passed in an ASCIMP structure. The ASCIMP structure is defined and documented in the oc_types.h header file. Examples
SetAsHolderSheet Sets whether worksheet as holder sheet. Examples
SetAsLabel Sets a row of the worksheet to a label of the given type. Examples
SetBounds Set the begining and ending row indices for the specified columns in this Worksheet. Examples
SetCells Put a group of values into a row in worksheet Examples

SetCellComment Set cell comment Examples
SetColDesignations Used to apply designation pattern to an entire worksheet Examples
SetColFormats Sets the column formats in a worksheet. Examples
SetEmbeddingParams Sets embedding parameters if there is an embedding at the cell identified by nRow, nCol and dwEmbedParams Examples
SetEvenSampling Many operations in Origin, like plotting and some analysis routines can run faster if a column is set to be evenly spaced. Set a column or all columns in worksheet to be evenly spaced so there is no to use X column Examples
SetLowerBound Set the beginning row indices for the specified columns in the Worksheet. Examples
SetPrintArea Use to set printing area. Pass NULL to clear existing printing area. Examples
SetRange Set the beginning and ending row indices for the specified columns in this Worksheet. Examples
SetScript Worksheet script setting Examples
SetSelectedRange Highlight ranges as selected specified by input row and column indices Examples
SetSize Set the number of columns and rows of worksheet Examples
SetUpperBound Set the ending row display index for the specified columns in this Worksheet. Index values are 0 based offset. Examples
ShowCol Show or hide column. Examples
ShowGridLines Show or Hide the display of vertical (Column) or horizontal (Row) grid lines in a workbook Examples
Showheaders Show or hide the Row or Column headers. Examples
ShowLabelCategoryNames Show or hide display of row header labels Examples
ShowLabels Show or hide column labels Examples

ShowRow Show or hide row Examples
Sort Sort the specified columns in a worksheet in ascending or descending order based on the values in the specified column number. All column and row numbers are 0 based offsets. Examples
SortColumns Sort columns by row content. Examples
StackColumnsByDesignation This function stack columns by plot designation. Each column designation is unique in each combination.When there is a missing column in front/middle of the combination, repeat the column from last combination. Note:disregardful columns would be ignore Examples
Type Dump the contents of the worksheet into the designated target window. Examples
UpdateOrigin Updates the underlying Origin worksheet from Excel Examples
Worksheet Construct a worksheet object and attach to named worksheet window Examples
WriteRecordset Write worksheet data into recordset Examples

Property

Name Brief Example
Columns The Collection of all Columns in a Worksheet Examples
EmbeddedPages A Collection of all Embedded Pages in a Worksheet Examples