Tabbed Panel Grids Demo

This sample illustrates the several aspects of working with a CalcWorkbook, which holds a collection of CalcSheet objects. The CalcSheet objects give you an ICalcData implementation for a rectangular collection of cells. These cells can be referenced using an Excel-like notation, A1, B13, and AB21. Thus, a CalcSheet object can recognize formulas such as =A1 + B3 or =Sum(A1:D5).

Features:

The sample uses a tab control with one tab page for each CalcSheet so that the you are able to see the effects of working with the CalcWorkbook.

To display the cells, each tab page has a panel (referred to as a PanelGrid) with an array of text boxes that are displayed in a tabular fashion. Each text box maps to a cell in a CalcSheet and displays the values or formulas for a particular cell. The top-left text box is A1; the one under A1 is A2, and so on.

This is displayed in the following image.

Rectangular array of textboxes to display data from a CalcSheet object screenshot
Rectangular Array of Text Boxes Displaying Data from CalcSheet Object

Loading an SSS file

An SSS file is basically a tab delimited file that holds a collection of CalcSheets in a CalcWorkbook object.

There is additional work required to create the supporting PanelGrid in this particular sample.

Saving an SSS file

Saving a CalcWorkbook as an SSS file is a matter of calling the WriteSSS method on the CalcWorkbook object.

Adding a CalcSheet to a CalcWorkbook

A CalcWorkbook has a CalcSheetList collection that holds the CalcSheets within a CalcWorkbook. To add a CalcSheet, you must use the CalcSheetList collection.

Removing a CalcSheet from a CalcWorkbook

You can again use the CalcSheetList collection when you want to remove a sheet from a CalcWorkbook.

Populating random data or formulae in several ways

Menu handlers populate a CalcSheet in various ways.

The following image depicts this placement of values.

CalcSheet initialized with random data screenshot
CalcSheet Initialized with Random Data

This handler adds sum functions to the last row and last column, to sum the other cells in the row and column.

A sample is illustrated in the following image.

CalcSheet with summations in the bottom-most row and right-most column. Cell E2 is displaying its formula screenshot
CalcSheet with Summations

Another sample is illustrated in the following image.

CalcSheet with a 'chain' of formulas. Changing the value in cell A1 will affect all the other cells screenshot
CalcSheet with "Chain" of Formulae