Skip to main content

ASPxDiagram.Export() Method

Exports the diagram data in JSON format.

Namespace: DevExpress.Web.ASPxDiagram

Assembly: DevExpress.Web.ASPxDiagram.v22.1.dll

Declaration

public string Export()

Returns

Type Description
String

The diagram data in JSON format.

Remarks

The Export method allows you to save information about the diagram’s layout, appearance, and shape positions.

The control saves the diagram’s data in its own text format. The resulting JSON object contains measurements in twips, regardless of the Units or ViewUnits property values. Do not modify this JSON object because modified data can load incorrectly.

Use the Import(String) method to load this data to the ASPxDiagram control.

<dx:ASPxDiagram ID="Diagram" runat="server" Width="100%" Height="600px"/>
<dx:ASPxButton ID="btnSave" runat="server" Text="Save" OnClick="btnSave_Click"/>
<dx:ASPxButton ID="btnLoad" runat="server" Text="Load" OnClick="btnLoad_Click" />
using System.IO;
...
protected void btnSave_Click(object sender, EventArgs e) {
    using (StreamWriter diagramData = File.CreateText(MapPath(diagramDataPath))) {
        diagramData.WriteLine(Diagram.Export());
    }
}
protected void btnLoad_Click(object sender, EventArgs e) {
    Diagram.Import(File.ReadAllText(MapPath(diagramDataPath)));
}

Use the ASPxClientDiagram.Export and ASPxClientDiagram.Import methods to save and load the diagram data on the client side.

See Also