Office.ValueFormat enum
Gibt an, ob von der aufgerufenen Methode zurückgegebene Werte wie Zahlen und Datumsangaben mit angewendeten Formatierungen zurückgegeben werden.
Hinweise
Wenn der valueFormat-Parameter beispielsweise als "formatiert" angegeben wird, wird die Formatierung einer als Währung formatierten Zahl oder eines Datums, das in der Office-Anwendung als TT.MM.JJ formatiert ist, beibehalten. Wenn der valueFormat-Parameter als "unformatted" angegeben wird, wird ein Datum im zugrunde liegenden sequenziellen Serienzifferformat zurückgegeben.
Verwendet von
Beispiele
/* Set the selection options. These will:
- Pass the string "myContext" to the callback.
- Include both visible and hidden data.
- Return the formatted values of the selection
(for an Excel date, 1/1/2023 instead of 44928).
*/
const options: Office.GetSelectedDataOptions = {
asyncContext: "myContext",
filterType: Office.FilterType.All,
valueFormat: Office.ValueFormat.Formatted
}
// Get the selected data in the Office document as text.
Office.context.document.getSelectedDataAsync(
Office.CoercionType.Text,
options,
(asyncResult) => {
if (asyncResult.status === Office.AsyncResultStatus.Failed) {
console.error(`${asyncResult.asyncContext}: asyncResult.error.message`);
} else {
console.log(`The selected data is "${asyncResult.value}".`);
}
});
Felder
| Formatted | Gibt formatierte Daten zurück. |
| Unformatted | Gibt unformatierte Daten zurück. |