Spread WPF Documentation
FormatMode Enumeration
Example Example 


Specifies the format string mode for a formatter.
Syntax
'Declaration
 
Public Enum FormatMode 
   Inherits System.Enum
'Usage
 
Dim instance As FormatMode
public enum FormatMode : System.Enum 
Members
MemberDescription
CustomMode[0] Indicates whether to format the value with the Excel-compatible format string.
StandardDateTimeMode[1] Indicates whether to format the value with the standard date-time format.
StandardNumericMode[2] Indicates whether to format the value with the standard numeric format.
Example
This example sets the FormatMode enumeration.
double dvalue = 12345.6789;       
gcSpreadSheet1.Sheets[0].Cells[0, 0].Formatter = new GrapeCity.Windows.SpreadSheet.Data.GeneralFormatter(GrapeCity.Windows.SpreadSheet.Data.FormatMode.StandardNumericMode, "c");
gcSpreadSheet1.Sheets[0].Cells[0, 0].Value = dvalue;
gcSpreadSheet1.Sheets[0].Cells[0, 1].Formatter = new GrapeCity.Windows.SpreadSheet.Data.GeneralFormatter(GrapeCity.Windows.SpreadSheet.Data.FormatMode.StandardDateTimeMode, "M");
gcSpreadSheet1.Sheets[0].SetValue(0, 1, new DateTime(2011, 2, 9));
gcSpreadSheet1.Sheets[0].Cells[0, 2].Formatter = new GrapeCity.Windows.SpreadSheet.Data.GeneralFormatter("m");
gcSpreadSheet1.Sheets[0].SetValue(0, 2, new DateTime(2012, 10, 15));
gcSpreadSheet1.Sheets[0].Cells[0, 3].Formatter = new GrapeCity.Windows.SpreadSheet.Data.GeneralFormatter();
gcSpreadSheet1.Sheets[0].SetValue(0, 3, new DateTime(2012, 10, 15));
gcSpreadSheet1.Sheets[0].Cells[0, 4].Formatter = new GrapeCity.Windows.SpreadSheet.Data.GeneralFormatter(GrapeCity.Windows.SpreadSheet.Data.FormatMode.CustomMode, "#.#%");
gcSpreadSheet1.Sheets[0].SetValue(0, 4, 1);
gcSpreadSheet1.Sheets[0].Cells[1, 0].Formatter = new GrapeCity.Windows.SpreadSheet.Data.GeneralFormatter(GrapeCity.Windows.SpreadSheet.Data.FormatMode.CustomMode, "[>2]0.0;[<-3]0.0;zero;");
gcSpreadSheet1.Sheets[0].SetValue(1, 0, 3);
gcSpreadSheet1.Sheets[0].Cells[2, 0].Formatter = new GrapeCity.Windows.SpreadSheet.Data.GeneralFormatter(GrapeCity.Windows.SpreadSheet.Data.FormatMode.CustomMode, "[Red](#,##0.00)");
gcSpreadSheet1.Sheets[0].SetValue(2, 0, 3);
gcSpreadSheet1.Sheets[0].Cells[3, 0].Formatter = new GrapeCity.Windows.SpreadSheet.Data.GeneralFormatter(GrapeCity.Windows.SpreadSheet.Data.FormatMode.CustomMode, @"(#.##)\[;-#.##\]\[;0.0\]\[;zero\]");
gcSpreadSheet1.Sheets[0].SetValue(3, 0, 3);
gcSpreadSheet1.Invalidate();
Dim dvalue As Double
dvalue = 12345.6789
GcSpreadSheet1.Sheets(0).Cells(0, 0).Formatter = New GrapeCity.Windows.SpreadSheet.Data.GeneralFormatter(GrapeCity.Windows.SpreadSheet.Data.FormatMode.StandardNumericMode, "c")
GcSpreadSheet1.Sheets(0).Cells(0, 0).Value = dvalue
GcSpreadSheet1.Sheets(0).Cells(0, 1).Formatter = New GrapeCity.Windows.SpreadSheet.Data.GeneralFormatter(GrapeCity.Windows.SpreadSheet.Data.FormatMode.StandardDateTimeMode, "M")
GcSpreadSheet1.Sheets(0).SetValue(0, 1, New DateTime(2011, 2, 9))
GcSpreadSheet1.Sheets(0).Cells(0, 2).Formatter = New GrapeCity.Windows.SpreadSheet.Data.GeneralFormatter("m")
GcSpreadSheet1.Sheets(0).SetValue(0, 2, New DateTime(2012, 10, 15))
GcSpreadSheet1.Sheets(0).Cells(0, 3).Formatter = New GrapeCity.Windows.SpreadSheet.Data.GeneralFormatter()
GcSpreadSheet1.Sheets(0).SetValue(0, 3, New DateTime(2012, 10, 15))
GcSpreadSheet1.Sheets(0).Cells(0, 4).Formatter = New GrapeCity.Windows.SpreadSheet.Data.GeneralFormatter(GrapeCity.Windows.SpreadSheet.Data.FormatMode.CustomMode, "#.#%")
GcSpreadSheet1.Sheets(0).SetValue(0, 4, 1)
GcSpreadSheet1.Sheets(0).Cells(1, 0).Formatter = New GrapeCity.Windows.SpreadSheet.Data.GeneralFormatter(GrapeCity.Windows.SpreadSheet.Data.FormatMode.CustomMode, "[>2]0.0;[<-3]0.0;zero;")
GcSpreadSheet1.Sheets(0).SetValue(1, 0, 3)
gcSpreadSheet1.Sheets(0).Cells(2, 0).Formatter = New GrapeCity.Windows.SpreadSheet.Data.GeneralFormatter(GrapeCity.Windows.SpreadSheet.Data.FormatMode.CustomMode, "[Red](#,##0.00)")
gcSpreadSheet1.Sheets(0).SetValue(2, 0, 3)
gcSpreadSheet1.Sheets(0).Cells(3, 0).Formatter = New GrapeCity.Windows.SpreadSheet.Data.GeneralFormatter(GrapeCity.Windows.SpreadSheet.Data.FormatMode.CustomMode, "(#.##)\[;-#.##\]\[;0.0\]\[;zero\]")
gcSpreadSheet1.Sheets(0).SetValue(3, 0, 3)
GcSpreadSheet1.Invalidate()
Inheritance Hierarchy

System.Object
   System.ValueType
      System.Enum
         GrapeCity.Windows.SpreadSheet.Data.FormatMode

Requirements

Target Platforms: Windows 7, Windows 8 Desktop, Windows Vista SP1 or later, Windows Server 2000, Windows 2000 Professional (SP4), Windows XP (SP2), Windows 2008, Windows 2003 Server (SP1)

See Also

Reference

GrapeCity.Windows.SpreadSheet.Data Namespace

 

 


Copyright © GrapeCity, inc. All rights reserved.