Microsoft Office Tutorials and References
In Depth Information
Web Service API Methods
xlSessionId = xlEcsApi.OpenWorkbook(
xlStatus = xlEcsApi.Refresh(xlSessionId, “”);
xlStatus = xlEcsApi.Refresh(xlSessionId, “oneSource”);
The CalculateA1 method of the Excel Services web service calculates the entire workbook, a single
sheet, a named range, a named object, or a range that is specified with A1 notation. The declaration for
the CalculateA1 method looks like this:
public Status CalculateA1(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 CalculateA1 call. Making a CalculateA1 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
that is to be calculated.
rangeName (in) — Use this string to specify the single cell or range to be calculated. You can
specify the rangeName using a defined name that represents the range to be calculated, or an A1
notation. The name of an object (such as “Table1”) is also a valid value.
The behavior of CalculateA1 is dependent on the values provided for both the sheetName and the
rangeName parameters. Following are common uses for the CalculateA1 method:
Calculate workbook — The sheetName is either String.Empty or “”, and the rangeName
is either String.Empty or “”.
Calculate sheet — The sheetName is the name of a sheet, and the rangeName is either
String.Empty or “” .
Calculate a range — The sheetName is the name of a sheet, and the rangeName is a defined name
on the sheet used for sheetName. rangeName can reference a single cell or a contiguous range.
Calculate a range — The sheetName is the name of a sheet, and the rangeName is the A1
notation that references a single cell (such as “B2” ) or a contiguous range (such as “C4:F10” ).