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 z. B. als "formatiert" angegeben ist, wird die Formatierung für eine Zahl, die als Währung formatiert ist, oder ein Datum, das in der Office-Anwendung als mm/tt/yy formatiert ist, beibehalten. Wenn der valueFormat-Parameter als "unformatted" angegeben wird, wird ein Datum im zugrunde liegenden sequenziellen Serienzifferformat zurückgegeben.
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. |