3.1.4.86 PasteRange

Applies the cell contents, cell values or cell formatting of the cells contained in a specified source range to the cells contained in a specified destination range, after the user has performed a cut or copy operation.

The following is the WSDL port type specification of the PasteRange WSDL operation.

 <wsdl:operation name="PasteRange" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
   <wsdl:input wsaw:Action="http://schemas.microsoft.com/office/Excel/Server/WebServices/ExcelServerInternalService/ExcelServiceSoap/PasteRange" message="tns:ExcelServiceSoap_PasteRange_InputMessage" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"/>
   <wsdl:output wsaw:Action="http://schemas.microsoft.com/office/Excel/Server/WebServices/ExcelServerInternalService/ExcelServiceSoap/PasteRangeResponse" message="tns:ExcelServiceSoap_PasteRange_OutputMessage" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"/>
   <wsdl:fault wsaw:Action="http://schemas.microsoft.com/office/Excel/Server/WebServices/ExcelServerInternalService/ExcelServiceSoap/PasteRangeExcelServerMessageFault" name="ExcelServerMessageFault" message="tns:ExcelServiceSoap_PasteRange_ExcelServerMessageFault_FaultMessage" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"/>
 </wsdl:operation>

The protocol client sends an ExcelServiceSoap_PasteRange_InputMessage request message, and the protocol server responds with an ExcelServiceSoap_PasteRange_OutputMessage response message, as follows:

  1. The protocol client sends information identifying whether the user performed a cut or a copy operation prior to the PasteRange operation and which part of the content in the source range will be applied to the destination range.

  2. If the range specified in the destination field of the input message does NOT have the same number of columns (2) or rows (2) as the range specified in the source field of the input message, the protocol server modifies the destination range such that it contains the same number of columns (2) and rows (2) as the source range, but does NOT change the reference of the top-left cell of the destination range (top-right cell, respectively, if the active sheet is in right-to-left reading order)

  3. The protocol server applies the content of the cells in the source range to the cells in the modified destination range as follows:

    1. If the Copy flag of the types field in the input message is set:

      1. If the Paste flag of the types field in the input message is set, the protocol server applies the cell contents and the cell formatting of the cells in the source range to the cells in the destination range;

      2. If the Values flag of the types field in the input message is set, the protocol server applies the only cell values of the cells in the source range to the cells in the destination range;

      3. If the Formatting flag of the types field in the input message is set, the protocol server applies only the cell formatting of the cells in the source range to the cells in the destination range;

      4. If the Formulas flag of the types field in the input message is set, the protocol server applies only the cell contents (that is, excluding cell formatting) of the cells in the source range to the cells in the destination range;

    2. If the Cut flag of the types field in the input message is set:

      1. If the Paste flag of the types field in the input message is set, the protocol server applies the cell contents and the cell formatting of the cells in the source range to the cells in the destination range. In addition to that, the protocol server removes the cell contents and the cell formatting from the cells in the source range;

      2. If the Values, Formatting or Formulas flag is set in the types field of the input message, the protocol server takes no action;

Note, that in the process described above, the range of cells whose contents get modified might be different than the range specified in the destination field of the input message.

This operation is a state changing operation on the protocol server.

In the event of an application error on the protocol server during this operation, a SOAP fault is returned, as specified in section 2.2.2. The Id element of the ExcelServerMessage SHOULD<101> be one of the values specified in section 2.2.2.1 or any of the following values:

  • FormulaEditingNotEnabled

  • SetRangeFailure

  • ObjectTypeNotSupported

  • InvalidSheetName

  • RangeParseError

  • SpecifiedRangeNotFound

  • RangeDefinitionError

  • DiscontiguousRangeNotSupported

  • RangeRequestAreaExceeded

  • SheetRangeMismatch

  • OperationNotSupportedInViewOnly