Friday, July 04, 2008  



 FarPoint Technologies
 (800) 645-5913

 fpsales@fpoint.com



     
 »Spread for Windows Forms » Product Tour » Overview » Concepts

Previous Concepts Overview Next

  Back to Top
 Shortcut Objects
The spreadsheet objects, in the Spread namespace, can be accessed through a built-in set of shortcut objects. The shortcut objects help you interact with the Spread for Windows Forms control in a way that is probably familiar to you from working with other components or applications. Cells, columns, and rows are each considered objects. Styles and named styles provide ways to save customized appearances that can be applied to other sheets.

The Spread for Windows Forms control provides the following shortcut objects in the FpSpread class:
  • Cells
  • Columns
  • Rows
  • ColumnHeader
  • RowHeader
  • AlternatingRows
  • Sheet 
To use the shortcut objects, set their properties or call their methods. Many of the objects provide indices for specifying the sheet, row, column, or cell with which you want to work.

Use the shortcut objects for their ease of use. For example, the shortcut objects are fairly selfdocumenting. In Visual Studio .NET, the Intellisense feature provides additional information that help you use these objects.


 Object Parentage
For the objects in a Spread control, such as the sheet, column, and cell, there are formatting and other properties that each object inherits from what is called its "parent." A cell may inherit some formatting, for example the background color, from the sheet. If you set the alignment of text for all the cells in a column, the cell inherits that as well. Because of this object parentage, many properties and methods can be applied in different ways to different parts of a spreadsheet.

Of course, you can override the formatting that an individual cell inherits. But by default, objects inherit properties from their parents. So in a given context, the settings of any object are the composite of the settings of its parents that are being applied to that object. For example, you may set the text color for a cell at the cell level, but it may inherit the vertical alignment from the row and the border from its column, and the background color from the sheet. Since the background color may be set at several of these levels, certain rules of precedence must apply. The closer to the cell level, the higher the precedence. So if you set the background color of the cell, the settings inherited from the parents are overridden.


  Back to Top
 Underlying Models
The control provides the models that provide a basis for much of the customization that is possible with the control. The models are the underlying template from which the more commonly used shortcut objects are derived.

The shortcut objects access the underlying models. When you work with shortcut objects, you are actually working with the models in the control. For example, if you change the number of columns in a sheet using the Sheets shortcut object, the model for this (the default sheet axis model) is updated with that information.

To provide different features or customize the behavior or appearance of your application, you can extend the models to create new classes. For example you may do this to create a template control for all the developers in your organization. By creating your own class based on one of the models, you can create the customized class and provide it to all the developers to use.

Use the object models for the following benefits::
  • For better performance: if you are setting several properties, for example, your application will be faster if you set the properties for an object, and then assign that object to Spread.
  • For specialized features: if you want to create your own customized features, such as extending the data model to bring in a tab-delimited file, you can extend the BaseSheetDataModel to do so. If you want to create your own cell type or customize the behavior of how users select cells, you can do that through the models.
  • For consistency in development: if you are a development team that would like to have consistency in some custom style and custom behavior, make the changes in the models and the entire team can benefit.
  • For more complete understanding of the product: if you are using many of the features of the control, the most efficient way to customize the control is by first understanding the workings of the models upon which the objects are based.
To use the shortcut objects, set their properties or call their methods. Many of the objects provide indices for specifying the sheet, row, column, or cell with which you want to work.

Use the shortcut objects for their ease of use. For example, the shortcut objects are fairly selfdocumenting. In Visual Studio .NET, the Intellisense feature provides additional information that help you use these objects.


  Back to Top
 Formatted versus Unformatted Data
The Spread for Windows Forms control provides both text (formatted data) and value (unformatted data) properties for a cell. For example, in a currency cell, the formatted data could be $1,432.56, but the value would be 1432.56. The Text property of the cell would return the entire formatted string with currency symbol and thousand separator. The Value property of the cell could be used in formulas or other calculations. Remember that every cell has both properties. Depending on the cell type, the data in a cell may be handled differently. For cell types that have buttons or check boxes, the distinction is important.

Previous Concepts Overview Next

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

 
SD Times 'TOP 100' Industry Innovator - Read the press release (pdf)

Tour Home
Overview
Appearance
User Interaction
Cell Types
Formulas
Managing Data
Data Binding
Import/Export
Printing
Keyboard Interaction
Shapes
Models
Spread Designer
 
Map

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