Spread WPF 14
In This Topic
    Formatting the Database Column
    In This Topic

    You can format the values in the Unit Price column as currency values.

    1. Add the following CS or VB code to the project.
      CS Copy Code
      public MainPage()
      {
      InitializeComponent();
      GcSpreadSheet1.Sheets[0].Rows.Count = GcSpreadSheet1.Sheets[0].GetLastDirtyRow(GrapeCity.Windows.SpreadSheet.Data.StorageType.Data) + 1;
      GcSpreadSheet1.Sheets[0].Columns.Count = GcSpreadSheet1.Sheets[0].GetLastDirtyColumn(GrapeCity.Windows.SpreadSheet.Data.StorageType.Data) + 1;
      GcSpreadSheet1.Sheets[0].Cells[1, 4, 77, 4].Formatter = new GrapeCity.Windows.SpreadSheet.Data.GeneralFormatter(GrapeCity.Windows.SpreadSheet.Data.FormatMode.StandardNumericMode, "c");
      }
      VB.NET Copy Code
      Public Sub New()
      InitializeComponent()
      GcSpreadSheet1.Sheets(0).Rows.Count = GcSpreadSheet1.Sheets(0).GetLastDirtyRow(GrapeCity.Windows.SpreadSheet.Data.StorageType.Data) + 1
      GcSpreadSheet1.Sheets(0).Columns.Count = GcSpreadSheet1.Sheets(0).GetLastDirtyColumn(GrapeCity.Windows.SpreadSheet.Data.StorageType.Data) + 1
      GcSpreadSheet1.Sheets(0).Cells(1, 4, 77, 4).Formatter = New GrapeCity.Windows.SpreadSheet.Data.GeneralFormatter(GrapeCity.Windows.SpreadSheet.Data.FormatMode.StandardNumericMode, "c")
      End Sub
    2. Save the project.

    3. Run the project to see the currency values in the Unit Price column. 

      Formatted Unit Price column with currency values

    4. You have completed this tutorial.