Creating new files using Office for the web¶
Hosts can create new Office files using blank document templates from Office for the web. In order to support this, hosts use
editnew WOPI action as follows:
Create a zero-byte file with the appropriate file extension (
docxfor Word documents,
pptxfor PowerPoint presentations, and
xlsxfor Excel workbooks).
editnewaction has been invoked, Office for the web will perform a PutFile operation on the file, overwriting it with template content appropriate to the file type. Note that this PutFile operation will be performed on an unlocked file, so hosts must ensure that PutFile operations on unlocked files that are zero bytes succeed. See the PutFile documentation for more information.
Because the new file creation is done in two steps, it is possible for the PutFile operation to fail, leaving the zero-byte file. Since such a file is not valid, hosts should expect and handle this case. The ultimate solution is left to the host; options for handling this situation include:
Hide zero-byte files from the user.
Prevent users from opening zero-byte files in Office for the web.
If a file is zero bytes, then when opening Office for the web against the file, always use the
editnewaction. (This is only an option if the user has edit permissions to the document.)
This is not an exhaustive list of options; ultimately, the host must decide the best approach to this problem.