All docs
V20.1
20.2 (EAP/Beta)
20.1
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+
The page you are viewing does not exist in the .NET Core 3.0+ platform documentation. This link will take you to the parent topic of the current section.

IWebSpreadsheetValueStorage Interface

Declares members of he Spreadsheet editor's value storage.

Namespace: DevExpress.ExpressApp.Office.Web

Assembly: DevExpress.ExpressApp.Office.Web.v20.1.dll

Declaration

public interface IWebSpreadsheetValueStorage
Public Interface IWebSpreadsheetValueStorage

Remarks

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

TIP

We recommend you to use the ASPxSpreadsheetPropertyEditor.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 ASP.NET Module project, create a class that implements the IWebSpreadsheetValueStorage interface as shown below:

    using DevExpress.ExpressApp.Office.Web;
    using DevExpress.Spreadsheet;
    using DevExpress.Web.ASPxSpreadsheet;
    using System.IO;
    // ...
    public class WebOpenXmlSpreadsheetValueStorage : IWebSpreadsheetValueStorage {
        public object GetValue(ASPxSpreadsheet control) {
            using (MemoryStream memoryStream = new MemoryStream()) {
                control.SaveCopy(memoryStream, DocumentFormat.OpenXml);
                using (StreamReader streamReader = new StreamReader(memoryStream)) {
                    memoryStream.Seek(0, SeekOrigin.Begin);
                    return streamReader.ReadToEnd();
                }
            }
        }
        public void SetValue(ASPxSpreadsheet control, object propertyValue, string documentID) {
            control.Open(documentID, DocumentFormat.OpenXml, () => (byte[])propertyValue);
        }
    }
    
  2. Create a View Controller and access the ASPxSpreadsheetPropertyEditor as described in the Ways to Access UI Elements and Their Controls topic. Set the editor's ValueStorage property to an instance of CustomWebSpreadsheetValueStorage as shown below.

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