Compartilhar via


ExcelService.GetRangeA1 Method

Gets calculated values from a range in the open workbook, using the Excel "A1" range specification.

Namespace:  Microsoft.Office.Excel.Server.WebServices
Assembly:  Microsoft.Office.Excel.Server.WebServices (in Microsoft.Office.Excel.Server.WebServices.dll)

Syntax

'Declaration
<WebMethodAttribute> _
Public Function GetRangeA1 ( _
    sessionId As String, _
    sheetName As String, _
    rangeName As String, _
    formatted As Boolean, _
    <OutAttribute> ByRef status As Status() _
) As Object()
'Usage
Dim instance As ExcelService
Dim sessionId As String
Dim sheetName As String
Dim rangeName As String
Dim formatted As Boolean
Dim status As Status()
Dim returnValue As Object()

returnValue = instance.GetRangeA1(sessionId, _
    sheetName, rangeName, formatted, _
    status)
[WebMethodAttribute]
public Object[] GetRangeA1(
    string sessionId,
    string sheetName,
    string rangeName,
    bool formatted,
    out Status[] status
)

Parameters

  • sessionId
    Type: System.String

    The Excel Web Services session ID.

  • sheetName
    Type: System.String

    The name of the sheet that you want to reference. Sheet name length is limited to 31 characters.

  • rangeName
    Type: System.String

    A range name can be a range reference, a named range, or a named data object. A rangeName string can contain a sheet name; for example, "Sheet1!A1:G17".

  • formatted
    Type: System.Boolean

    true to return formatted strings.

    false to return raw values.

  • status
    Type: []

    Alert information.

Return Value

Type: []
Array of values for the requested range.

Remarks

This method returns an array of values from a range of cells, using a range name string to select the range.

A range can be a range reference, a named range, or a named data object.

The returned array has the exact dimensionality of the requested range. Null objects represent empty cells.

Formatted values respect the cell format or the default format, but are independent of any layout or grid modifications. Specifically, there is no concept of cell width for a value returned through the API, which means:

  • No number signs (####) are returned if the cell width is too small to display the formatted value.

  • In general format, no "precision displayed" rounding is done.

  • No fill-in is performed, even if a fill-in character is defined in the cell format.

Excel Web Services returns a jagged array of type "object". Each entry represents a row, and is defined as an array of type "object"; each entry is mapped to one cell value.

A null object represents an empty cell. The array is jagged technically, but should be rectangular in dimensionality, meaning that all row arrays should have the same number of entries.

If the formatted parameter is set to true, this method will return the Empty string for empty cells.

If the formatted parameter is set to false, this method will return Null for empty cells.

See Also

Reference

ExcelService Class

ExcelService Members

Microsoft.Office.Excel.Server.WebServices Namespace