Spread 8.0 Documentation
Example
Support Options

Glossary Item Box

Example


The following example adds cells A2 and A3 on sheet 2 and places the total in cell A1 on sheet 1.

C++

// Set number of sheets

m_Spread.SetSheetCount(3);

// Set properties for sheet 1

m_Spread.SetSheet(1);

m_Spread.SetSheetName("test");

m_Spread.SetAllowUserFormulas(TRUE);

m_Spread.SetMaxRows(5);
m_Spread.SetMaxCols(5);

m_Spread.SetCol(-1);

m_Spread.SetRow(-1);

m_Spread.SetCellType(13);

// Set properties for sheet 2

m_Spread.SetSheet(2);

m_Spread.SetSheetName("test2");

m_Spread.SetAllowUserFormulas(TRUE);

m_Spread.SetMaxRows(5);
m_Spread.SetMaxCols(5);

m_Spread.SetCol(-1);

m_Spread.SetRow(-1);

m_Spread.SetCellType(13);

m_Spread.SetSheet(1);

m_Spread.SetCol(1);

m_Spread.SetRow(1);
m_Spread.SetFormula("test2!A2+test2!A3");

Visual Basic

Private Sub Form_Load()

' Create sheets

fpSpread1.SheetCount = 3

' Set properties for sheet 1

fpSpread1.Sheet = 1

fpSpread1.SheetName = "test"

fpSpread1.AllowUserFormulas = True

fpSpread1.MaxCols = 5

fpSpread1.MaxRows = 5

fpSpread1.Col = -1

fpSpread1.Row = -1

fpSpread1.CellType = CellTypeNumber

' Set properties for sheet 2

fpSpread1.Sheet = 2

fpSpread1.SheetName = "test2"

fpSpread1.AllowUserFormulas = True

fpSpread1.MaxCols = 5

fpSpread1.MaxRows = 5

fpSpread1.Col = -1

fpSpread1.Row = -1

fpSpread1.CellType = CellTypeNumber

' Set formula for sheet 1 that uses sheet 2

fpSpread1.Sheet = 1

fpSpread1.Col = 1

fpSpread1.Row = 1

fpSpread1.Formula = "test2!A2+test2!A3"

End Sub

© 2002-2014 ComponentOne, a division of GrapeCity. All Rights Reserved.