Microsoft Office Tutorials and References
In Depth Information
Web Service API Methods
xlStatus = xlEcsApi.SetRange(
The SetCellA1 method of the Excel Services web service sets a value into a single cell that you specify
using the A1 notation, a named range, or a named object. The declaration for the SetCellA1 method
looks like this:
public Status SetCellA1(string sessionId, string sheetName, string rangeName,
Following are the parameters for this method:
sessionId (in) — The sessionId string that was returned from a prior OpenWorkbook call.
The session must still be active at the time of the SetCellA1 call. Making a SetCellA1 call
using a sessionId that has timed out results in a SOAP exception.
sheetName (in) — Use this string to specify the name of the sheet containing the rangeName .
You can pass the sheetName as String.Empty or “” when you use a defined name or the name
of an object for the rangeName .
rangeName (in) — Use this string to specify the range where the value is to be set. Specify the
rangeName using a defined name, or an object name that represents the cell where the value is
to be set. You can also use A1 notation.
cellValue (in) — This is an object that is the value to be set in the specified rangeName . An
empty cell is represented in the object as null .
If the rangeName is not a 1x1 range, a SOAP exception occurs.
A status object is returned by default with a value of null . See the “Status Class” section, earlier in this
chapter, for an explanation of this return type.
The following example makes two SetCellA1 calls. Comments are provided prior to each SetCellA1
call to describe what is going to be set.