Spread Windows Forms 11.0 Product Documentation
Serialize Method (ExcelSparklineSetting)
Example 


FarPoint.Win.Spread Assembly > FarPoint.Win.Spread Namespace > ExcelSparklineSetting Class : Serialize Method
XmlTextWriter object used to save the object
Saves the object to XML.
Syntax
'Declaration
 
Public Function Serialize( _
   ByVal w As XmlTextWriter _
) As Boolean
'Usage
 
Dim instance As ExcelSparklineSetting
Dim w As XmlTextWriter
Dim value As Boolean
 
value = instance.Serialize(w)
public bool Serialize( 
   XmlTextWriter w
)

Parameters

w
XmlTextWriter object used to save the object

Return Value

true if successful; otherwise, false
Example
This example uses the Serialize method.
FarPoint.Win.Spread.ExcelSparklineSetting eSetting = new FarPoint.Win.Spread.ExcelSparklineSetting();
eSetting.ShowMarkers = true;
eSetting.AxisColor = Color.Cyan;
eSetting.DateAxis = true;
eSetting.DisplayEmptyCellsAs = FarPoint.Win.Spread.Chart.EmptyValueStyle.Gaps;
eSetting.DisplayHidden = true;
eSetting.DisplayXAxis = true;
eSetting.FirstMarkerColor = Color.AliceBlue;
eSetting.Formula = "Sheet1!$A$4:$E$4";
eSetting.HighMarkerColor = Color.Honeydew;
eSetting.LastMarkerColor = Color.Lavender;
eSetting.LineWeight = 2;
eSetting.LowMarkerColor = Color.LawnGreen;
eSetting.ManualMax = 3;
eSetting.ManualMin = 1;
eSetting.MarkersColor = Color.Magenta;
eSetting.MaxAxisType = FarPoint.Win.Spread.SparklineAxisMinMax.Custom;
eSetting.MinAxisType = FarPoint.Win.Spread.SparklineAxisMinMax.Individual;
eSetting.NegativeColor = Color.NavajoWhite;
eSetting.RightToLeft = true;
eSetting.SeriesColor = Color.SeaGreen;
eSetting.ShowFirst = true;
eSetting.ShowHigh = true;
eSetting.ShowLast = true;
eSetting.ShowLow = true;
eSetting.ShowNegative = true;

FarPoint.Win.Spread.ExcelSparklineSetting ess = eSetting;
string fileName = "c:\\ExcelSparklineSetting.xml";

//Serialize
System.IO.Stream stream;
stream = System.IO.File.Open(fileName, System.IO.FileMode.Create);
System.Xml.XmlTextWriter writer = new System.Xml.XmlTextWriter(stream, System.Text.Encoding.UTF8);
writer.Formatting = System.Xml.Formatting.Indented; writer.Indentation = 2;
writer.WriteStartDocument();
writer.WriteStartElement("ExcelSparklineSetting");
writer.WriteEndElement();
writer.WriteEndDocument();
writer.Close();

//Deserialize
FarPoint.Win.Spread.ExcelSparklineSetting ess1 = new FarPoint.Win.Spread.ExcelSparklineSetting();
System.Xml.XmlDocument doc = new System.Xml.XmlDocument();
doc.Load(fileName);
System.Xml.XmlNode node;
node = doc.FirstChild;
while (!node.Name.Equals("ExcelSparklineSetting"))
    node = node.NextSibling;
System.Xml.XmlNodeReader r = new System.Xml.XmlNodeReader(node);
r.Read();
Dim eSetting As New FarPoint.Win.Spread.ExcelSparklineSetting()
eSetting.ShowMarkers = True
eSetting.AxisColor = Color.Cyan
eSetting.DateAxis = True
eSetting.DisplayEmptyCellsAs = FarPoint.Win.Spread.Chart.EmptyValueStyle.Gaps
eSetting.DisplayHidden = True
eSetting.DisplayXAxis = True
eSetting.FirstMarkerColor = Color.AliceBlue
eSetting.Formula = "Sheet1!$A$4:$E$4"
eSetting.HighMarkerColor = Color.Honeydew
eSetting.LastMarkerColor = Color.Lavender
eSetting.LineWeight = 2
eSetting.LowMarkerColor = Color.LawnGreen
eSetting.ManualMax = 3
eSetting.ManualMin = 1
eSetting.MarkersColor = Color.Magenta
eSetting.MaxAxisType = FarPoint.Win.Spread.SparklineAxisMinMax.[Custom]
eSetting.MinAxisType = FarPoint.Win.Spread.SparklineAxisMinMax.Individual
eSetting.NegativeColor = Color.NavajoWhite
eSetting.RightToLeft = True
eSetting.SeriesColor = Color.SeaGreen
eSetting.ShowFirst = True
eSetting.ShowHigh = True
eSetting.ShowLast = True
eSetting.ShowLow = True
eSetting.ShowNegative = True

Dim ess As FarPoint.Win.Spread.ExcelSparklineSetting = eSetting
Dim fileName As String = "c:\ExcelSparklineSetting.xml"

'Serialize
Dim stream As System.IO.Stream
stream = System.IO.File.Open(fileName, System.IO.FileMode.Create)
Dim writer As New System.Xml.XmlTextWriter(stream, System.Text.Encoding.UTF8)
writer.Formatting = System.Xml.Formatting.Indented
writer.Indentation = 2
writer.WriteStartDocument()
writer.WriteStartElement("ExcelSparklineSetting")
writer.WriteEndElement()
writer.WriteEndDocument()
writer.Close()

'Deserialize
Dim ess1 As New FarPoint.Win.Spread.ExcelSparklineSetting()
Dim doc As New System.Xml.XmlDocument()
doc.Load(fileName)
Dim node As System.Xml.XmlNode
node = doc.FirstChild
While Not node.Name.Equals("ExcelSparklineSetting")
    node = node.NextSibling
End While
Dim r As New System.Xml.XmlNodeReader(node)
r.Read()
See Also

Reference

ExcelSparklineSetting Class
ExcelSparklineSetting Members