javascriptms-wordms-officeoffice365-apps

How to iterate through Enum's from the Word Javascript API?


Currently I'm trying to figure out how to get a list of all the styles within word (just the built in ones is fine) within the javascript API (I am developing a taskpane add-in) and I'm really struggling as to how I am supposed to access these properties of the Word.Style enum. Object.keys(Word.Style) doesn't work, using an array style index doesn't work, Object.values() doesnt work and there are no methods on the documentation for accessing it. If anyone has any ideas as to how these enum's work that would be greatly appreciated.


Solution

  • Word.Style contains an array of every default style in word. It is an array which does not need to be loaded or accessed from context - it is simply a part of the API loaded in with office.OnReady().