Spread Windows Forms 17
Spread Windows Forms 17.0 Product Documentation / Developer's Guide / Chart Control / Creating Charts / Using the Chart Control on sheet / Saving or Loading a Chart
In This Topic
    Saving or Loading a Chart
    In This Topic

    You can read or write to a file or stream using the IXmlSerializable interface.

    Example

    The following code writes to a file.

    C#
    Copy Code
    FarPoint.Win.Chart.ChartModel model = chart.Model;
    System.Xml.XmlTextWriter writer = new System.Xml.XmlTextWriter(@"c:\temp\test.xml", null);
    model.WriteXml(writer);
    writer.Close();
    
    Visual Basic
    Copy Code
    Dim model As FarPoint.Win.Chart.ChartModel = chart.Model
    Dim writer As New System.Xml.XmlTextWriter("c:\temp\test.xml", Nothing)
    model.WriteXml(writer)
    writer.Close()
    

    The following code reads from a file.

    C#
    Copy Code
    FarPoint.Win.Chart.ChartModel model = chart.Model;
    System.Xml.XmlTextReader reader = new System.Xml.XmlTextReader(@"c:\temp\test.xml");
    model.ReadXml(reader);
    reader.Close();
    
    Visual Basic
    Copy Code
    Dim model As FarPoint.Win.Chart.ChartModel = Chart.Model
    Dim reader As New System.Xml.XmlTextReader("c:\temp\test.xml")
    model.ReadXml(reader)
    reader.Close()
    

    SPREAD デザイナの使用

    1. Run Chart Designer.
    2. Select the Open Chart Model or Save Chart Model icon at the left end of the icons lined up at the top.
    For information on starting Chart Designer, refer to Chart Designer in the SPREAD Designer Guide.
    See Also