office-addins

Settings API for office add-ins (Office.js) is not working in Excel

醉酒当歌 提交于 2020-01-16 09:09:08
问题 In my Excel add-in, I save settings via the common Settings API, like this: Office.context.document.settings.set("user-selected-stock","MSFT"); Office.context.document.settings.saveAsync(); Starting about a week ago, many of my add-in users have begun complaining that this feature is no longer working. I was able to confirm that the problem is an issue with Excel, because a user was able to reproduce the issue with the People Graph add-in, which is built by Microsoft and preinstalled by

How to retrieve the Query string value from web word instance

↘锁芯ラ 提交于 2020-01-16 08:44:07
问题 I'm creating a web add-in for Word targeting Word Online. When a document is opened using Word Online, the URL will contain a file name. I am trying to retrieve that file name. To retrieve this URL I tried using window.location href, but it is fetching my hosted addin web application URL. Is it possible to get the Word Online URL? Sample Code : function getParameterByName(name, url) { if (!url) url = window.location.search; name = name.replace(/[\[\]]/g, '\\$&'); var regex = new RegExp('[?&]'

getRestApiId function in objects from office-js for OneNote

风流意气都作罢 提交于 2020-01-15 05:14:08
问题 I'm developing add-in for OneNote and I've had trouble use OneNote REST APIs, as office-js doesn't give ID compatible with REST APIs. StackOverflow UserVoice And as I know that the ID from office-js is not unique, I had to retrieve data from REST API using clientUrl to get the unique ID and it took around 5-6 secs per each call. It was our big issue and couldn't find any workaround for this. But after a few months, I just found there is a function named getRestApiId in objects from office-js

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

In Office Apps - Cannot redefine non-configurable property 'context'"

谁都会走 提交于 2020-01-05 04:23:15
问题 This is similar to In Office Apps for Excel 2013 - Cannot redefine non-configurable property 'context'". However it only happens on IE 11 and Edge. My use case is followin: I open outlook or any office application add-in. I run a pop-up for OAuth, on popup close i redirect the iframe to another page. First time i open the addin and finish OAuth flow everything is working correctly. However when I close the add-in and open it again (this time redirect is done automatically because user is

How to check that Word 2007 invoke autosave into word addin?

故事扮演 提交于 2020-01-04 17:33:11
问题 I have some functionality inside DocumentBeforeSave event handler. That's should work only when user manually invoke Save (press Save button). But word 2007 have autosave function and event DocumentBeforeSave throws each time when autosave work. How to check that save is invoked over Autosave or User manually invoke Save? 回答1: It looks like there's no build-in way of doing that because the object model simply doesn't support it (per this link), but you can use VBA to override the default save

OfficeJS Outlook Add-in Does Not Install

柔情痞子 提交于 2020-01-03 02:57:09
问题 UPDATE #1: TL;DR: I want to target: Outlook 2016 or later Outlook on the Web Outlook 2016 for Mac Outlook for iOS Outlook for Android I require Mailbox 1.5 in order to support calling the Outlook REST APIs and to support pinnable taskpanes. Since pinnable taskpanes are only supported in Outlook 2016 for Windows, and because Mailbox 1.5 is currently only supported in Outlook on the Web, I will need to set Mailbox 1.5 in the <VersionOverrides> sections of the manifest. Based on the validation

Word insertOoxml method returning Error: Unknown for all input

你说的曾经没有我的故事 提交于 2020-01-01 06:46:10
问题 I have an existing Word Add-In solution that has been working well for a long time that now cannot insert OOXML content into Word documents. Trying to break this down I can't get the insertOoxml method to work under any circumstance. To reproduce: await Word.run(async (context) => { context.document.getSelection().insertOoxml(theOoxml, 'Start'); await context.sync(); }); Where theOoxml can be any valid Ooxml string. The reference example I have been using is: <pkg:package xmlns:pkg="http:/

Serialize current ActiveDocument from office 2007 add-in

女生的网名这么多〃 提交于 2019-12-29 01:17:33
问题 Im creating a VSTO Office 2007 add-in. I need to be enable or find a solution where I can save to a webservice with a byte[] instead of hard drive. So, I open the document by going to a website and clicking on a url, that click send me a Word Document, and I select Open using MS Word 2007. The document open, and if I check the data I have: ActiveDocument.Fullname = http://[servername or ip]/[some iis folder]/file.asp?id=353&type=doc` so I think this is all in memory since I dont have the

Set custom document properties with Word interop

我只是一个虾纸丫 提交于 2019-12-28 18:05:25
问题 I want to set some custom document properties of a word document I'm creating in my C# code. To do this, I followed this MSDN article and came up with this code: using Word = Microsoft.Office.Interop.Word; // Version 12.0.0.0 word = new Word.Application(); word.Visible = false; Word._Document doc = word.Documents.Add(ref missing, ref missing, ref missing, ref missing); logger.Info("Setting document properties"); Core.DocumentProperties properties = (Core.DocumentProperties)doc