简体   繁体   中英

How to create Word office with name from createDocument(base64File) API or any another methods/API?

I am doing below for word document:-

Step 1. Open document from base64. Please check below link. Document is open with random name like Document1, Document 2

https://docs.microsoft.com/en-us/javascript/api/word/word.application?view=word-js-preview#word-word-application-createdocument-member(1)

  await Word.run(async (context) => {
        var newDoc = context.application.createDocument(base64);
        context.load(newDoc);
        //Want to give document name like newDoc.name ="sample documents"
        return context.sync().then(function () {
            newDoc.open();
        });

      });

Step-2 We are passing base 64 from our Rest API so want to open document with new name and also pass some custom data to new documents.

OfficeJS doesn't provide anything for that out of the box.

Feature requests on Tech Community are considered, when the dev team go through the planning process. Use the github label: Type: product feature request at https://aka.ms/M365dev-suggestions .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM