I'm developing an Office Task Pane app that needs to access the whole document. I know there is an API getFileAsync()
https://msdn.microsoft.com/en-us/library/office/jj220084.aspx
Office.context.document.getFileAsync(fileType [, options], callback);
However,the fileType
can only be three values: compressed
, pdf
, text
.
compressed
Returns the entire document (.pptx or .docx) in Office Open XML (OOXML) format as a byte array.
pdf
Returns the entire document in PDF format as a byte array.
text
Returns only the text of the document as a string. (Word only)
When it is compressed
, the returned value is a byte array.
How can I get an OOXml string?
Or is there an API to select all content in a document so that I can use the getSelectedDataAsync()
API?
this is a little late.
I've been working with Task Pane apps lately and, as it turns out, OOXML is natively compressed (unless I'm grossly mistaken).
My best advice would be to figure out the encoding that the string is encoded at, and decode with that encoding type. I'm willing to bet that it's UTF-8.
In case someone finds this thread, I managed to solve this using zip.js.
Hopefully there will be a easier way in the future.