Spread Windows Forms 7.0 Product Documentation
Understanding the Axis Model
Support Options
Spread Windows Forms 7.0 Product Documentation > Developer's Guide > Understanding the Underlying Models > Finding More Details on the Sheet Models > Understanding the Axis Model

Glossary Item Box

The axis model includes the methods that manage row- and column-related settings of the spreadsheet, that is, how the rows and columns of cells are oriented on the sheet. This includes many of the axis-related settings in the following shortcut objects:

These settings include:

To use the underlying axis model, use the methods of the axis model. These include the SetSize method, for setting the row height or column width, and the SetVisible method for setting the row or column visible properties. There are other methods, too, such as SetMergePolicy, which set specific properties of the row or column, in this case whether cells can be automatically merged when their content is identical. Refer to the DefaultSheetAxisModel class for more information on the axis model in general and the methods in particular.

As an example of how you could use the axis model to improve performance of a spreadsheet, consider a spreadsheet with an very large number of rows. If you are resizing the rows based on the data, then you might want to create a custom axis model for SheetView.Models.RowAxis to return this value. This only requires creating a class derived from DefaultSheetAxisModel that takes a reference to the SheetView in its constructor and stores it in a field. Then override the GetSize method to call GetPreferredRowHeight (in the SheetView) for the row index. You can also override the GetResizable method to prevent the user from trying to change the row heights manually, which will not work since GetSize is always returning the preferred height.

As an example, here is some code that makes each row three times wider than the default width.

C# Copy Code
public class MyRowAxisModel : FarPoint.Web.Spread.Model.DefaultSheetAxisModel 
{ 
  public overrides int GetSize(int index) 
  { 
    if ( index % 2 == 1 ) 
      return 60; 
    else 
      return 20; } 
}
VB Copy Code
Public Class MyRowAxisModel 
  Inherits FarPoint.Web.Spread.Model.DefaultSheetAxisModel 
  Public Overrides Function GetSize(index As Integer) As Integer 
    If index \ 2 = 1 Then 
      Return 60 
    Else 
      Return 20 
    End If 
  End Function 
End Class

For more details, refer to the BaseSheetAxisModel class, the DefaultSheetAxisModel class, and the ISheetAxisModel interface.

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