Spread ASP.NET 6.0 Product Documentation
Improving the Display by Changing the Cell Type
Send Feedback
Spread ASP.NET 6.0 Product Documentation > Developer's Guide > Managing Data Binding > Tutorial: Binding to a Corporate Database > Improving the Display by Changing the Cell Type

Glossary Item Box

In this step, you will change the cell type for one of the columns to better display the data from the database.

  1. Double-click on the form to open the code window.
  2. Set the cell type for the UnitPrice column by adding the following code below the code you have already added:
    C# Copy Code
    FarPoint.Web.Spread.StyleInfo style = new FarPoint.Web.Spread.StyleInfo();
    FarPoint.Web.Spread.CurrencyCellType curPrice = new FarPoint.Web.Spread.CurrencyCellType();
    curPrice.FixedPoint = true;
    style.CellType = curPrice;
    style.HorizontalAlign = HorizontalAlign.Right;
    style.VerticalAlign = VerticalAlign.Middle;
    FpSpread1.ActiveSheetView.SetStyleInfo(-1, 3, style);
    
    Visual Basic Copy Code
    Dim style As FarPoint.Web.Spread.StyleInfo
    style = New FarPoint.Web.Spread.StyleInfo()
    Dim curPrice As New FarPoint.Web.Spread.CurrencyCellType()
    curPrice.FixedPoint = True
    style.CellType = curPrice
    style.HorizontalAlign = HorizontalAlign.Right
    style.VerticalAlign = VerticalAlign.Middle
    FpSpread1.ActiveSheetView.SetStyleInfo(-1, 3, style)
    
  3. Save your project.

Run your project and you should see a form that looks similar to the following:

Databound Spread with Cell Type Set

Your bound Spread component is complete! You have completed this tutorial.

Return to the overview of the Tutorial: Binding to a Corporate Database tutorial.

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