# Loading or Saving the Chart Control to XML

Learn how you can load or save the Chart control to or from an XML file using Spread for ASP.NET. Learn more in documentation.

## Content

You can load or save the Chart control to or from an XML file. This option is available at design time if you select the Chart control on the form and select the chart verb. Select the **Save to XML** or **Load from XML** menu option. Use the [LoadFromTemplate](/spreadnet/api/latest/online-asp/FarPoint.Web.Chart/FarPoint.Web.Chart.FpChart.LoadFromTemplate.html) or [SaveToTemplate](/spreadnet/api/latest/online-asp/FarPoint.Web.Chart/FarPoint.Web.Chart.FpChart.SaveToTemplate.html) methods at run time.

## Using Code

Save or load a Chart control to an XML file.

## Example

The following example saves or loads a Chart control.

```csharp
string f;
f = "c:\\chart.xml";
System.IO.FileStream s = new System.IO.FileStream(f, IO.FileMode.OpenorCreate, IO.FileAccess.ReadWrite);
FpChart1.SaveToTemplate(s);
//FpChart1.LoadFromTemplate(s);
```

```vbnet
Dim f As String
f = "c:\chart.xml"
Dim s As New System.IO.FileStream(f, IO.FileMode.OpenOrCreate, IO.FileAccess.ReadWrite)
FpChart1.SaveToTemplate(s)
'FpChart1.LoadFromTemplate(s)
```