Back to Devexpress

SpreadsheetExtension.GetCurrentDocument(String) Method

aspnetmvc-devexpress-dot-web-dot-mvc-dot-spreadsheetextension-dot-getcurrentdocument-x28-system-dot-string-x29.md

latest4.2 KB
Original Source

SpreadsheetExtension.GetCurrentDocument(String) Method

Gets access to a workbook loaded into the specified Spreadsheet.

Namespace : DevExpress.Web.Mvc

Assembly : DevExpress.Web.Mvc5.v25.2.dll

NuGet Package : DevExpress.Web.Mvc5

Declaration

csharp
public static IWorkbook GetCurrentDocument(
    string extensionName
)
vb
Public Shared Function GetCurrentDocument(
    extensionName As String
) As IWorkbook

Parameters

NameTypeDescription
extensionNameString

A string value specifying the Spreadsheet name.

|

Returns

TypeDescription
IWorkbook

A IWorkbook interface specifying a document loaded in the Spreadsheet.

|

The following code snippets (auto-collected from DevExpress Examples) contain references to the GetCurrentDocument(String) method.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

asp-net-mvc-spreadsheet-modify-document/CS/DXWebApplication1/Controllers/HomeController.cs#L24

csharp
public ActionResult CustomAction(string customCommand) {
    IWorkbook workbook = SpreadsheetExtension.GetCurrentDocument("Spreadsheet");
    Worksheet worksheet = workbook.Worksheets[0];

asp-net-mvc-spreadsheet-send-ajax-requests-to-server-to-get-cell-values/CS/T318446/Controllers/HomeController.cs#L19

csharp
public ActionResult ValidateSpreadsheet(object Spreadsheet) {
    IWorkbook myWorkBook = SpreadsheetExtension.GetCurrentDocument("Spreadsheet");
    int test = Convert.ToInt32(myWorkBook.Worksheets[0].Cells["B3"].Value.NumericValue);

asp-net-mvc-spreadsheet-modify-document/VB/DXWebApplication1/Controllers/HomeController.vb#L17

vb
Public Function CustomAction(ByVal customCommand As String) As ActionResult
    Dim workbook As IWorkbook = SpreadsheetExtension.GetCurrentDocument("Spreadsheet")
    Dim worksheet As Worksheet = workbook.Worksheets(0)

asp-net-mvc-spreadsheet-send-ajax-requests-to-server-to-get-cell-values/VB/T318446/Controllers/HomeController.vb#L19

vb
Public Function ValidateSpreadsheet(ByVal Spreadsheet As Object) As ActionResult
    Dim myWorkBook As IWorkbook = SpreadsheetExtension.GetCurrentDocument("Spreadsheet")
    Dim test As Integer = Convert.ToInt32(myWorkBook.Worksheets(0).Cells("B3").Value.NumericValue)

See Also

SpreadsheetExtension Class

SpreadsheetExtension Members

DevExpress.Web.Mvc Namespace