All docs
V19.2
19.2
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.
.NET Framework 4.5.2+
.NET Framework 4.5.2+
.NET Standard 2.0+
The page you are viewing does not exist in the .NET Standard 2.0+ platform documentation. This link will take you to the parent topic of the current section.
.NET Core 3.0+

ISpreadsheetValueStorage Interface

Declares members of the Spreadsheet editor's value storage.

Namespace: DevExpress.ExpressApp.Office.Win

Assembly: DevExpress.ExpressApp.Office.Win.v19.2.dll

Declaration

public interface ISpreadsheetValueStorage
Public Interface ISpreadsheetValueStorage

Remarks

A Spreadsheet editor's value storage allows you to implement custom logic executed when saving or loading a Spreadsheet document. Follow the steps below to create a custom value storage that specifies a file storage format.

TIP

We recommend you to use the SpreadsheetPropertyEditor.DocumentFormat property to specify a document storage format (see How to: Customize the Spreadsheet Editor). The example below is shown for demonstration purposes.

  1. In the WinForms Module project, create a class that implements the ISpreadsheetValueStorage interface as shown below:

    using DevExpress.ExpressApp.Office.Win;
    using DevExpress.Spreadsheet;
    using DevExpress.XtraSpreadsheet;
    // ...
    public class OpenXmlSpreadsheetValueStorage : ISpreadsheetValueStorage {
        public object GetValue(SpreadsheetControl control) {
            return control.SaveDocument(DocumentFormat.OpenXml);
        }
        public void SetValue(SpreadsheetControl control, object propertyValue) {
            byte[] byteArray = propertyValue as byte[];
            if(byteArray != null) {
                control.LoadDocument(byteArray, DocumentFormat.OpenXml);
            }
        }
    }
    
  2. Create a View Controller and access the SpreadsheetPropertyEditor as described in the Ways to Access UI Elements and Their Controls topic. Set the editor's ValueStorage property to an instance of CustomSpreadsheetValueStorage as shown below:

    using DevExpress.ExpressApp;
    using DevExpress.ExpressApp.Office.Win;
    // ...
    public class CustomSpreadsheetValueStorageController : ObjectViewController<DetailView, Document> {
        protected override void OnActivated() {
            base.OnActivated();
            SpreadsheetPropertyEditor spreadsheetPropertyEditor = View.FindItem("Data") as SpreadsheetPropertyEditor;
            if (spreadsheetPropertyEditor != null) {
                spreadsheetPropertyEditor.ValueStorage = new OpenXmlSpreadsheetValueStorage();
            }
        }
    }
    
See Also