Back to Devexpress

PivotGridControl.SaveLayoutToXml(String, OptionsLayoutBase) Method

windowsforms-devexpress-dot-xtrapivotgrid-dot-pivotgridcontrol-dot-savelayouttoxml-x28-system-dot-string-devexpress-dot-utils-dot-optionslayoutbase-x29.md

latest4.8 KB
Original Source

PivotGridControl.SaveLayoutToXml(String, OptionsLayoutBase) Method

SECURITY-RELATED CONSIDERATIONS

Using file paths sourced from untrusted input may expose unauthorized files or allow unintended file access. Always validate and normalize all external paths to prevent path manipulation.

Saves a Pivot Grid Control’s layout to the specified XML file, using the specified settings.

Namespace : DevExpress.XtraPivotGrid

Assembly : DevExpress.XtraPivotGrid.v25.2.dll

NuGet Package : DevExpress.Win.PivotGrid

Declaration

csharp
public void SaveLayoutToXml(
    string xmlFile,
    OptionsLayoutBase options
)
vb
Public Sub SaveLayoutToXml(
    xmlFile As String,
    options As OptionsLayoutBase
)

Parameters

NameTypeDescription
xmlFileString

A string value specifying the path to the file where the Pivot Grid Control’s layout settings should be stored. If an empty string is specified, an exception is raised.

| | options | OptionsLayoutBase |

A OptionsLayoutBase descendant that specifies which options should be saved.

|

Remarks

Use the SaveLayoutToXml method to save specific settings of a Pivot Grid Control to a file in XML format. These settings can then be restored via the PivotGridControl.RestoreLayoutFromXml method.

Note that you should specify unique names for all pivot grid fields to correctly save and restore the layout. You can do this using the PivotGridFieldBase.Name property.

The options parameter determines which options should be saved to the file. For the Pivot Grid Control a OptionsLayoutGrid object can be created, customized as required and then passed as the options parameter. Only the options that are enabled in this object will be saved.

To save all the options you can pass null or the static OptionsLayoutBase.FullLayout property as the options parameter.

The SaveLayoutToXml overload without the options parameter saves only the options which are specified by the PivotGridControl.OptionsLayout property.

Note

The expansion states of field values are not saved by the SaveLayoutToXml method.

Tip

You can utilize the Persistence Behavior or Workspace Manager component to save and restore layouts for all supported DevExpress controls at once.

See Also

RestoreLayoutFromXml

SaveLayoutToRegistry

SaveLayoutToStream

SaveCollapsedStateToFile(String)

SaveCollapsedStateToStream(Stream)

LoadCollapsedStateFromFile(String)

LoadCollapsedStateFromStream(Stream)

LayoutUpgrade

OptionsLayout

Save and Restore Layouts of DevExpress controls

PivotGridControl Class

PivotGridControl Members

DevExpress.XtraPivotGrid Namespace