Office.OfficeThemeChangedEventArgs interface
提供引发 Office.EventType.OfficeThemeChanged
事件的更新的 Office 主题。
注解
示例
// Adds an event handler for the OfficeThemeChanged event.
Office.onReady(() => {
document.addEventListener('DOMContentLoaded', () => {
// Get a reference to the mailbox and use it to add an event handler.
const mailbox = Office.context.mailbox;
mailbox.addHandlerAsync(Office.EventType.OfficeThemeChanged, officeThemeChangedHandler, (result) => {
if (result.status === Office.AsyncResultStatus.Failed) {
console.error(`Failed to add event handler: ${asyncResult.error.message}`);
return;
}
console.log("Event handler added successfully.");
});
});
});
// Handles the OfficeThemeChanged event.
function officeThemeChangedHandler(event) {
console.log(`Event: ${event.type}`);
const currentTheme = event.officeTheme;
// Perform operations based on the current theme.
}
属性
office |
获取更新的 Office 主题。 |
type | 获取事件的类型。 有关详细信息,请参阅 Office.EventType。 |
属性详细信息
officeTheme
获取更新的 Office 主题。
officeTheme: Office.OfficeTheme;