Spread Sheet Applet

Written by:    Hien Chris Do
Last Modified: 5/1/97 (this file last modified 7/18/2006)

Source code and documentation Copyright © 1997 by Hien Chris Do

General Information:

This applet was written to be a very simple spread sheet program that has much of the basic functionality of most commercial spread sheet software. The spread sheet is composed of a table of cells, and each cell has a name associated with it. The name starts with a single character (A-Z) that identifies its column followed by a number (0-99) that identifies its row. So cell C2 would be the second row down from the top and the third column from the left. These row identifiers are only used in formulas which will discussed later.

Cell Types:

A cell type is associated with each cell in the spread sheet. Each cell has both a string value and a numeric (double) value. Three cell types are used in this applet.

Label Cell Type: This cell type stores the string representation for the cell. Its numeric value is 0.0 so any calculation that involves a cell of type Label will be returned a 0.0 for the cell's numeric value. Label cell types are displayed in black in the spread sheet applet.

Numeric Cell Type: This cell type stores the cell's numeric representation as a type double. Its string value is the string representation of the numeric value. Numeric cell types are displayed in blue in the spread sheet applet.

Formula Cell Type: This cell type stores the result of the calculated formula as a type double. It's string value is the string representation of the formula itself and not the resulting calculation of the formula. Formula cell types are displayed in red in the spread sheet applet. This cell type must be start with an "=" to be recognized as a Formula cell type. Writing formulas are discussed below.


Formulas can be used to calculate cell values by putting an "=" (without the double quotes) at the beginning of the cell string. Following the "=" can any basic arithmetic operation such as +, -, /, and *. Supported functions can also be incorporated into the formula by placing "@" followed by the function name. For instance, to take the average of cells A1, A2, A3, and A4 and then add 5 to it, type the following: = @SUM(A1:A4) + 5


The following is a list of functions that are supported by this applet. A short description of each function is located next to the function name.

Selecting Cells:

Cells can be selected by clicking on it. Selected cell(s) will be highlighted in yellow to show that they are selected. To select multiple cells, click on the beginning cell and drag to the ending cell. Any cell in between the beginning and ending cell will be selected.

Copy & Paste

To copy the contents of a cell or multiple cells to another location simply select the cell or cells to be copied and click on the copy button. After which, select a destination cell and click on the paste button. Everything that is copied will look exactly like it's original content with the exception of formulas. Formulas that include cell references will be automatically adjusted to the new location. When copying multiple cells to a new location, make sure that the dimensions of the copied cells are compatible with the dimensions of the destination cells. This is useful when more than one copy of the copied cells are desired. If only one copy is desired at the new location, then simply select the beginning cell of the destination and the appropriate copies will be made. For example, if the copied cells had a 2x3 dimension, then to make one copy at a new location, either select a single beginning cell at the new location or select a 2x3 cell matrix. The result of this would be the same. To make two copies of the selected cells, you must select a destination matrix of dimension 4x3 or 2x6 depending if you wanted a vertical copied set or horizontal copied set.


Cut works in much of the same way as copy except that the original content is cleared.


Clear the contents of the select cell(s).

Inserting Rows:

Rows can be inserted by selecting a cell and then clicking on the insert row button. The new row will be inserted to the top of the topmost selected cell. Multiple rows can be inserted by first selecting multiple rows and then clicking the insert row button. The number of rows that were selected will be the number of rows added to the top of the topmost selected cell.

Removing Rows:

Rows can be removed by selecting a cell or multiple cells and then clicking on the remove row button. Any row that contains the selected cell(s) will be removed.

Inserting Columns:

Inserting columns is takes the same process as inserting a row. The only difference is that the new column will be inserted to the left of the leftmost selected cell.