Spread Windows Forms 6.0 Product Documentation
SetFormatString Method
See Also  Example Support Options
FarPoint.Win.Spread Assembly > FarPoint.Win.Spread.CellType Namespace > GeneralCellType Class : SetFormatString Method


value
Format string for formatting values
isDateFormat
Whether to consider the number as a date and time

Glossary Item Box

Sets the format string for formatting values.

Syntax

Visual Basic (Declaration) 
Public Sub SetFormatString( _
   ByVal value As String, _
   ByVal isDateFormat As Boolean _
) 
Visual Basic (Usage)Copy Code
Dim instance As GeneralCellType
Dim value As String
Dim isDateFormat As Boolean
 
instance.SetFormatString(value, isDateFormat)
C# 
public void SetFormatString( 
   string value,
   bool isDateFormat
)

Parameters

value
Format string for formatting values
isDateFormat
Whether to consider the number as a date and time

Example

This example shows the use of this method for a currency cell but the use is similar for any cell type.

C#Copy Code
FarPoint.Win.Spread.CellType.CurrencyCellType curr = new FarPoint.Win.Spread.CellType.CurrencyCellType();
curr.DecimalSeparator = ",";
curr.DecimalPlaces = 3;
fpSpread1.ActiveSheet.Cells[0, 0].CellType = curr;
fpSpread1.ActiveSheet.Cells[0, 0].Value = 443.0908;
bool b; 
System.Xml.XmlDocument doc = new System.Xml.XmlDocument(); 
doc.Load("..\\files\\mycurr.xml"); 
System.Xml.XmlNode node;  
node = doc.FirstChild; 
while (!node.Name.Equals("Currency")) 
    node = node.NextSibling; 
System.Xml.XmlNodeReader r = new System.Xml.XmlNodeReader(node); 
r.Read(); 
b = curr.Deserialize(r); 
listBox1.Items.Add(b.ToString());
Visual BasicCopy Code
Dim curr As New FarPoint.Win.Spread.CellType.CurrencyCellType()
curr.DecimalSeparator = ","
curr.DecimalPlaces = 3
FpSpread1.ActiveSheet.Cells(0, 0).CellType = curr
FpSpread1.ActiveSheet.Cells(0, 0).Value = 443.9098
Dim b As Boolean
Dim doc As New System.Xml.XmlDocument()
doc.Load("..\files\mycurr.xml")
Dim node As System.Xml.XmlNode
node = doc.FirstChild
While Not (node.Name.Equals("Currency"))
node = node.NextSibling
End While
Dim r As New System.Xml.XmlNodeReader(node)
r.Read()
b = curr.Deserialize(r)
ListBox1.Items.Add(b)

Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

© 2002-2012 ComponentOne, a division of GrapeCity. All Rights Reserved.