Compartilhar via


ExcelService.SetCellA1 Method

Sets a value or formula into a cell 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 Sub SetCellA1 ( _
    sessionId As String, _
    sheetName As String, _
    rangeName As String, _
    cellValue As Object, _
    <OutAttribute> ByRef status As Status() _
)
'Usage
Dim instance As ExcelService
Dim sessionId As String
Dim sheetName As String
Dim rangeName As String
Dim cellValue As Object
Dim status As Status()

instance.SetCellA1(sessionId, sheetName, _
    rangeName, cellValue, status)
[WebMethodAttribute]
public void SetCellA1(
    string sessionId,
    string sheetName,
    string rangeName,
    Object cellValue,
    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".

  • status
    Type: []

    Alert information.

Remarks

Sets a value (number or text) or a formula into a workbook cell, using a range name string to select the range. Setting a value or a formula into a cell replaces the previous value or formula, but does not affect the formatting of the cell.

Setting a formula into a cell requires open item or edit item permissions and is supported in view and edit mode You will get an unable to set formula alert if you attempt to set a formula into a cell in view mode with only view item permission.

If you are setting values to multiple adjacent cells, you may want to consider using the SetRangeA1(String, String, String, [], []) method instead of making multiple calls to the SetCellA1(String, String, String, Object, []) method. This would result in a single roundtrip to the server instead of multiple roundtrips. It may also result in fewer calculation steps. Therefore, in some cases, you may gain a noticeable performance improvement by using the SetRangeA1(String, String, String, [], []) method instead of the SetCellA1(String, String, String, Object, []) method.

See Also

Reference

ExcelService Class

ExcelService Members

Microsoft.Office.Excel.Server.WebServices Namespace