CoercionType

You do not have to explicitly specify a coerciontype when using getSelectedDataAsync and setSelectedDataAsync.
The type will be inferred if possible.


Examples - Document.getSelectedDataAsync

Office.context.document.getSelectedDataAsync( 
   Office.CoercionType _coerciontype [, Object _options] [, function _callback])

_coerciontype - The type of data that you want to get.
_options - This is a collection of key/value pairs separated by a colon.
_callback - This is invoked once the aysnchronous operation is complete.


Office.context.document.setSelectedDataAsync( 
   Object _data [, Object _options] [, function _callback])

_data - This is the value that you want to set.
_options - This is a collection of key/value pairs separated by a colon.
_callback - This is invoked once the aysnchronous operation is complete.


Office.CoercionType

Text??
Table 
Image 
Matrix 
HTML 
Ooxml 

Named CoercionType

No callback function provided.

function setData(data) { 
   var options = {coercionType : Office.coercionType.Text};

   Office.context.document.setSelectedDataAsync(
      data,
      options
    );
}

Anonymous Inline CoercionType

No callback function provided.

function setData(data) { 
   Office.context.document.setSelectedDataAsync(
      data,
      {coercionType : Office.coercionType.Text}
   );
}


© 2019 Better Solutions Limited. All Rights Reserved. © 2019 Better Solutions Limited TopPrevNext