Microsoft Office Tutorials and References
In Depth Information
Web Service API Methods
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 SetRangeA1 call. Making a SetRangeA1 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 values are to be set. Specify
the rangeName using a defined name or an object name that represents the range where the
values are to be set. You can also use A1 notation.
rangeValues (in) — This is the array of values that are to be set in the specified rangeName.
Empty cells are represented in the array as null.
A SOAP exception occurs when the dimensions of the rangeValues object do not match the dimensions
of the rangeName.
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 SetRangeA1
The following example makes two SetRangeA1 calls. Comments are provided prior to each SetRangeA1
call to describe what is going to be set.
string xlSessionId;
Status[] xlStatus;
xlSessionId = xlEcsApi.OpenWorkbook(
@”http://theexcelserver/testsite/Shared Documents/workbook.xlsb”,
out xlStatus);
//define and create the data for the rangeValues
int height = 2, width = 3;
object[] rangeValues = new object[height];
object[] firstRow = new object[width];
object[] secondRow = new object[width];
for (int x = 0; x < width; x++)
firstRow[x] = x + x;
secondRow[x] = x + x + 1;
Search JabSto ::

Custom Search