Back to Devexpress

How to: Save and Restore Custom Cell Editors

wpf-400535-controls-and-libraries-spreadsheet-examples-customization-how-to-save-and-restore-custom-cell-editors.md

latest1.9 KB
Original Source

How to: Save and Restore Custom Cell Editors

  • Dec 11, 2023
  • 2 minutes to read

The SpreadsheetControl can save information about custom in-place editors to a file in XLS, XLSX, XLSB, XLT, and XLTX formats. This allows the SpreadsheetControl to restore custom editors when you load a document into the control again.

Custom editors from the predefined set are saved and restored automatically.

To save an editor supplied to cells via the SpreadsheetControl.CustomCellEdit event, use the following approach.

View Example

  1. Use the CustomCellInplaceEditorCollection.Add method to assign an editor of CustomCellInplaceEditorType.Custom type to a cell range and specify the textual value associated with this custom editor. The SpreadsheetControl saves the specified string to a file and then uses it to restore the editor.

  2. Handle the SpreadsheetControl.CustomCellEdit event to assign an editor (SpinEdit) to cells that are marked as containing the custom editor (“MySpinEdit”). To identify these cells, use the event’s SpreadsheetCustomCellEditEventArgs.ValueObject parameter.

See Also

Custom Cell In-place Editors