Thursday, August 28, 2008  



 FarPoint Technologies
 (800) 645-5913

 fpsales@fpoint.com



     
 »Spread for Web Forms » Product Tour » Object Model

Previous Robust Object Model Next

While Spread makes it easy and intuitive for your customer to edit and view data, more importantly, it also provides you with a robust object model to program against. You can use the helper objects or program directly against the models for the best performance.

Helper Objects
We've included helper objects to make it easy to program against Spread. While not quite as efficient as programming directly against the models, helper objects provide an intuitive programming layer on top of the models, making it easy to find what you need.

Accessing a specific sheet number:
FpSpread1.Sheets(sheetnum).xxx
Accessing the active sheet:
FpSpread1.ActiveSheetView.xxx

Accessing Rows, Columns, and Cells:
With FpSpread1.Sheets(sheetnum)
  .Rows(row [,optional row2]).xxx
  .Columns(col [,optional col2]).xxx
  .Cells(row, col [,optional row2, optional col2]).xxx
end with


For example,
With FpSpread1.Sheets(0)
  'Set row and column count for the sheet
  .ColumnCount = 3
  .RowCount = 5
  'Hide the column header
  .ColumnHeader.Visible = False

  'NOTE: Spread is 0 based
  'Set the row and column colors
  'Row 2
  .Rows(1).BackColor = Color.Beige
  'Columns 2 through 6
  .Columns(3, 7).ForeColor = Color.Red
  'Set a cell note to display on cell A1
  .Cells(0, 0).Note = "Cell Note"
  'Set up Button Cells for row 2, columns 1 through 6
  .Cells(1, 0, 1, 5).CellType = New ButtonCellType()
End With


Models
Use the models directly for the best performance and customization options

With FpSpread1.ActiveSheetView
  'Create the data and style models
  '10 rows, 4 columns
  Dim model As New FarPoint.Web.Spread.Model.DefaultSheetDataModel(10, 4)
  Dim style As New FarPoint.Web.Spread.StyleInfo()
  'Assign the datamodel to sheet 0
  FpSpread1.Sheets(0).DataModel = model

  'NOTE: Spread is 0 based
  'Add text to row 1, col 2
  model.SetValue(0, 1, "Contact Information")
  'Create a new style with font and Button celltype
  style.Reset()
  style.Font.Size = FontUnit.Parse(10)
  style.Font.Name = "Verdana"
  style.CellType = New ButtonCellType()
  'Apply the style
  FpSpread1.Sheets(0).SetStyleInfo(0, 0, style)
End With


Previous Robust Object Model Next

    
 Have a question?
Have a Question? Ask Us!
Subscribe to the RSS feed!RSS Subscribe
 

 
Learn about the new Roadshow now!

Tour Home
AJAX Support
Cell Merging
Conditional Formatting
Customer Usability
Customization
Data Binding
Editing
Excel Compatibility
Filtering
Formulas
Frozen Rows & Columns
Grouping
Hierarchy
Import / Export
Interaction
Load on Demand
Move Columns
Object Model
Operation Modes
Optimizing
Order Entry Sample
Protect that Data
Searching
Sheets
Skins
Sorting
Spread Designer
Unbound Mode
Worksheet
Please rate tour

Copyright © 1991-2007 FarPoint Technologies, Inc. All rights reserved. All names are property of their respective owners.