Microsoft Office Tutorials and References
In Depth Information
Web Service API Methods
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 GetRange call. Making a GetRange 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
rangeCoordinates.
rangeCoordinates (in) — Use this RangeCoordinates type to specify the range that is
to be retrieved. The range can be a single cell or a contiguous range. The rangeCoordinates
type has four properties:
Column — The zero-based integer index, where column A is 0.
Row — The zero-based integer row index, where row 1 is 0.
Height — An integer greater than 0, which represents the row height of the range.
Width — An integer greater than 0, which represents the column width of the range.
formatted (in) — Use this Boolean to specify whether formatted strings (true) or raw
values (false) are to be returned.
Status (out) — See the “Status Class” section, earlier in this chapter, for an explanation of
this ( out ) parameter.
Following are common uses for the GetRange method:
Retrieve a single cell — The sheetName is the name of a sheet, and the rangeCoordinates are
initialized as Column=0 , Row=0 , Height=1 , and Width=1 . This retrieves the value of cell A1.
Retrieve a range — sheetName is the name of a sheet and the rangeCoordinates are initialized
as: Column=0, Row=0, Height=1, and Width=2. This retrieves the values in the range A1:B1.
Return Value
An array of values for the requested range is returned. The returned array has the same dimensions as
the requested range. When the formatted parameter is true, string.empty is returned for empty
cells. When the formatted parameter is false, null is returned for empty cells.
GetRange returns the values from cells in hidden rows and columns. If column A is hidden and the
rangeName was “A1:B1”, then two objects would be returned: one for cell A1 and one for cell B1.
Calling GetRange
The following example makes a GetRange call. The range is defined using the RangeCoordinates
object, and then the GetRange method is called to retrieve the value in range E5:J9 on Sheet2. This
represents a range that is 5 rows by 6 columns.
try
{
string xlSessionId;
Search JabSto ::




Custom Search