office-js

`context.document.body.insertOoxml` breaks documents, crashes word

吃可爱长大的小学妹 提交于 2020-01-12 09:58:20
问题 I know this is not a question, but I was sent here by Rick Kirkham from here, and apparently asking on SO is the way to file bugs for Microsoft products :-p When I use insertOoxml with the 'replace' parameter, Word will insert extra content at the end. For example, when using the following code in Script Lab, with a new, empty word document: $("#run").click(run); function run() { Word.run(function (context) { var ooxml = context.document.body.getOoxml(); return context.sync().then(function ()

Office365 - Rest API - Message ItemAttachment loosing headers & attachments when forwarded

拜拜、爱过 提交于 2020-01-06 08:42:06
问题 I'm trying to send the email as an attachment to a user by creating draft message then attaching the #Microsoft.OutlookServices.ItemAttachment using /attachments The Item parameter sent in /attachments API call is the object received from API call made to get-a-message. But when the email is received the ItemAttachment is missing the original email headers and the original email attachment. The attachment is having only the following headers: From: --Removed-- To: --Removed-- Subject: -

Office.js Add-in: Insert image/picture in Excel 2016

我只是一个虾纸丫 提交于 2020-01-06 07:24:31
问题 How do you add a simple image to a specific location on an excel spreadsheet using the new Office.js api? 回答1: This answer explains how to do this in Word: https://stackoverflow.com/a/38194807/3806701, and similarly, I was able to do it this way Excel: insertImageBase64New() { Excel.run(async (ctx) => { let sheet = ctx.workbook.worksheets.getItem("Sheet1"); let address = "C3"; let range = sheet.getRange(address); range.select(); await ctx.sync(); Office.context.document.setSelectedDataAsync

What is the proper order of loading and syncing to conditionally delete an offset range of rows from a table?

冷暖自知 提交于 2020-01-06 06:37:26
问题 Trying to do maintenance on a table via an add-in. If the table has more than N rows, I want to delete all but N from the end. I finally got it to work in Script Lab as demonstrated in this gist: https://gist.github.com/70d3d62d32d4fe8f34279ab240f7b110 but it doesn't feel like I actually understand why it is working. I have to call sync, but doesn't matter if I call it before or after the delete call. I thought it made sense to wrap the delete inside a context.sync().then(()=>obj.delete); ,

Word JS APIs: extending a Range

亡梦爱人 提交于 2020-01-06 05:52:08
问题 While working on answering this question I would really like to have been able to extend a Range by a specific number of characters. In the COM API I would have used Range.MoveEnd() . Is there any equivalent that I didn't find in the JS API? Background: The question referenced is about finding search terms with more than 255 characters - which is a limit in Word for the desktop. The search fails. The simple way to go about it would be to search the first 254 characters, then expand the found

Excel office-js API - Insert values to a blank sheet

假如想象 提交于 2020-01-06 05:26:26
问题 How can I insert values into a blank sheet? The way that I currently know of for inserting values is by retrieving the range and then inserting the values using the values property, such as range.getRange("A1:" + cellBottomRight); range.load("values"); context.sync().then(function () { range.values = twoDimensionalArrayOfValues; }); Is there a simpler way by using a single function to simply insert the values, rather than first retrieving the range? Thanks! EDIT : I've been trying to create a

Manifest file passes Visual Studio test but fails when side loading to Office Web

妖精的绣舞 提交于 2020-01-06 04:51:14
问题 My Excel-js Addin manifest fails when I try to sideload for "Office on the web". The message is "Your Add-In Manifest is not valid". However, within Visual Studio 2017 when I right click on the solution and select "publish" then I click on "Perform a validation check" it passes with the message "Request Correlation ID: 78932cc8-3cff-458b-a211-730bdac4feb8". My add-in sideloads with no issues for the desktop version of Excel. I've tried multiple Windows and Mac machines. I use the button

“No add-ins currently available.” when deploying add-in using Centralized Deployment

大憨熊 提交于 2020-01-06 04:33:28
问题 I am trying to deploy an add-in with add-in commands on the desktop version of office 365, using the Centralized Deployment method. I followed the instructions for Centralized Deployment and the addin appears as "on" in the Office 365 admin center. I used both "Everyone" and "Specific User/Group", but when I open the Word application and go to Add-ins, under "Admin Managed" I see no addins , and the message "No add-ins currently available." The addin is'nt visible neither on Word 2016 Desktop

Office.js Apps: Excel cannot find the home.html file

徘徊边缘 提交于 2020-01-05 09:26:16
问题 I'm trying to learn how to write Office.js apps. I did use the example given here. Manifest file, QuarterlySalesReportManifest.xml, I did change the value of SourceLocation element to "\MY-PC\MySharedApp" which is the location of the "home.html". I also placed QuarterlySalesReportManifest.xml in another folder, "\MY-PC\MyManifest" and added this folder as a share location that contains the manifest as a trusted app catalog in Excel. When I try to run the app from Excel it seem the

How to get/read the name of the windows user who is editing the word document?

泄露秘密 提交于 2020-01-05 04:29:09
问题 I have recently started working on Microsoft word add ins , I would like to know if there is any way to get/read the name of the windows user who is editing the word document using Office.JS API. Hope my question makes sense. 回答1: Not directly at the moment. There is a new set of SSO functionality that just went into Preview however which would allow you to fetch the current user's profile from Microsoft Graph. See Enable single sign-on for Office Add-ins (preview) for details on how this