WorksheetPage

 

Contents

Name

WorksheetPage

Remark

The WorksheetPage class provides methods and properties common to all internal Origin worksheet pages (windows). The Project class contains a collection of WorksheetPage objects.

An Origin C WorksheetPage object is a wrapper object that is a reference to an internal Origin worksheet page 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 WorksheetPage class is derived from the Page, PageBase, and OriginObject classes from which it inherits methods and properties.

The Origin C Project class (Project.h) contains a collection of all worksheet pages in the open project file named WorksheetPages. Once accessed, a WorksheetPage object can be used to locate and access all layers (named Worksheets) within the Origin worksheet page (i.e. use the inherited Layers collection of the Page class). Each Worksheet (i.e. each layer of the worksheet page) contains a collection of all columns in the worksheet named Columns which can in turn be used to access the worksheet column properties and data object (or Dataset).

Hierarchy

Examples

EX1

// Assumes a Worksheet containing at least one Column exists in Origin
void WorksheetPage_ex1()
{
    WorksheetPage wp = Project.WorksheetPages(0);   // Get the first worksheet page from WorksheetPages collection
    if( wp )                                        // If wp IsValid...
    {
        Worksheet wks = wp.Layers();                // Get the active Worksheet from Layers collection
        if( wks )                                   // If wks IsValid...
        {
            Column col = wks.Columns(0);            // Get first Column in Worksheet
            if( col )                               // If col IsValid...
            {
                Dataset ds(col);                    // Get DataObject (Dataset) of column
                if( ds )                            // If ds IsValid...
                {
                    ds.SetSize(10);                 // Set size of data set
                    for(int ii = 0; ii < 10; ii++ )
                        ds[ii]=2*ii+5;              // Fill data set/column with values
                }
            }
        }
    }
}

header to Include

origin.h

Reference

Members

Name Brief Example
ClearData Clear all worksheets' data. Examples
ExcelSheet Connects to the Excel sheet named lpcszSheetName. Examples
GetExcelCOMObject Assuming the WorksheetPage contains an embedded Excel workbook, it returns the COM object associated with the Excel workbook, which allows direct COM programming of the Excel workbook. Examples
OpenExcel Open an Excel *.XLS file as either an Excel workbook or as an Origin workbook. Examples
SaveExcelInOpj Origin can save the excel data in OPJ file and is loaded internally on load. When called on a excel page, this function enables or disables such saving as requested. Examples
WorksheetPage Construct a WorksheetPage object using the name of an existing Origin worksheet page. Examples

Property

Name Brief Example
m_bIsExcel Read-only property. It is true if the page object is an Excel page. Examples