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


w
XmlTextWriter object used to save the object

Glossary Item Box

Saves the object to XML.

Syntax

Visual Basic (Declaration) 
Public Function Serialize( _
   ByVal w As XmlTextWriter _
) As Boolean
Visual Basic (Usage)Copy Code
Dim instance As ExcelSparklineSetting
Dim w As XmlTextWriter
Dim value As Boolean
 
value = instance.Serialize(w)
C# 
public bool Serialize( 
   XmlTextWriter w
)

Parameters

w
XmlTextWriter object used to save the object

Return Value

true if successful; false otherwise

Example

This example uses the Serialize method.
C#Copy Code
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();
Visual BasicCopy Code
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()

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.