Microsoft Office Tutorials and References
In Depth Information
Web Service API Methods
xlRange.Height = 2;
xlRange.Width = 1;
//calculate range A1:A2 on Sheet3
xlStatus = xlEcsApi.Calculate(xlSessionId, “Sheet3”, xlRange);
}
CalculateWorkbook
The CalculateWorkbook method of the Excel Services web service calculates the entire workbook
using one of the two supported types of calculation. The declaration for the CalculateWorkbook
method looks like this:
public Status[] CalculateWorkbook(string sessionId, CalculateType calculateType)
Parameters
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 CalculateWorkbook call. Making a
CalculateWorkbook call using a sessionId that has timed out results in a SOAP exception.
CalculateType (in) — Use this CalculateType type to specify the type of calculation
to be performed. There are two supported enumerators for CalculateType :
CalculateFull — All formulas are calculated, but the dependency tree is not rebuilt.
Recalculate — Only dirty formulas are calculated.
Return Value
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.
Calling CalculateWorkbook
The following example makes a CalculateWorkbook call using the CalculateFull enumerator:
try
{
string xlSessionId;
Status[] xlStatus;
xlSessionId = xlEcsApi.OpenWorkbook(
@”http://theexcelserver/testsite/Shared Documents/workbook.xlsb”,
@”en-US”,
@”de-DE”,
out xlStatus);
xlStatus = xlEcsApi.CalculateWorkbook(
xlSessionId,
CalculateType.CalculateFull);
}
Search JabSto ::




Custom Search