Spread ASP.NET 6.0 Product Documentation
Understanding the Axis Model
Send Feedback
Spread ASP.NET 6.0 Product Documentation > Developer's Guide > Using Sheet Models > Finding More Details on the Sheet Model > 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 Assembly Reference for more information on the axis model in general and to the DefaultSheetAxisModel methods in particular.

As an example of how you could use the axis model to improve performance of a spreadsheet, consider a spreadsheet with a 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 taller than the default height.

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

Return to the overview of Finding More Details on the Sheet Models.

© 2002-2012 GrapeCity, Inc. All Rights Reserved.