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

The axis model includes the methods that manage row- and column-related settings of the spreadsheet (how the rows and columns of cells are oriented on the sheet). The axis model 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 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. To do so, create 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.

The following code provides an example 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.