Spread Windows Forms 18
Spread Windows Forms 18 Product Documentation / Developer's Guide / Chart Control / Creating Charts / Using the Chart Control / Save/Load Chart Control
In This Topic
    Save/Load Chart Control
    In This Topic

    Chart controls can be saved to and loaded from an XML file. This feature is also available from the smart tag of the FpChart control placed on the form.

    Using Code

    You can load the XML file with the LoadFromTemplate method of the FpChart class and save it to the XML file with the SaveToTemplate method.

    Example

    The following sample code saves or loads the chart control into an XML file.

    C#
    Copy Code
    string f;
    f = "c:\\temp\\chart.xml";
    System.IO.FileStream s = new System.IO.FileStream(f, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.ReadWrite);
    fpChart1.SaveToTemplate(s);
    //fpChart1.LoadFromTemplate(s);
    
    Visual Basic
    Copy Code
    Dim f As String
    f = "c:\chart.xml"
    Dim s As New System.IO.FileStream(f, System.IO.FileMode.OpenOrCreate, System.IO.FileAccess.ReadWrite)
    FpChart1.SaveToTemplate(s)
    'FpChart1.LoadFromTemplate(s)