office-js

How to get the formatting of a Cell using Office.js

北战南征 提交于 2019-12-10 15:43:01
问题 I am developing an Excel Add-In that extracts the text of cell A1 INCLUDING its format and display the text in its own area. So the add in contains this (see screenshot below): • Area to display the formatted text • Button to start the extraction Please Click to view image bellow is the code that i am using to get the text function displaySelectedCells() { Office.context.document.getSelectedDataAsync(Office.CoercionType.Text, function (result) { if (result.status === Office.AsyncResultStatus

Get OneDrive Item Id for Current Word doc in a group drive

ぃ、小莉子 提交于 2019-12-10 13:17:32
问题 I'm working on a Office.js Word addin but document is stored on group drive. How can i get either or all of group id , drive id and item id for current document Related question is here But solution didn't work for me as it is for personal drive Current Solution I have a solution but i'm not sure it is sound The url I get in getFilePropertiesAsync is in following format <siteUrl>/sites/<groupnamelikestring>/Shared Documents/<pathtodoc> siteUrl : Its a site url like https://abc.sharepoint.com

PowerPoint Web Add-In: get data within document

五迷三道 提交于 2019-12-10 12:16:57
问题 Is it possible to get all data in PPT document? Something like getSelectedDataAsync method but for all data whether selected or not. I want to verify the content(Text) of the PPT document. 回答1: The PPT JS API is not yet as rich as the Excel and Word ones, and today there is no API to do this directly. There is an intricate workaround where you need to get the entire file (pptx) (using the getFileAsync method) send it to service that uses the OOXML SDK to open it and grab the content you need.

Excel JS Add-In works in Excel but not Excel Online

微笑、不失礼 提交于 2019-12-10 11:46:50
问题 I've built an Excel JS Task Pane add-in using the WoodGrove Expense Trends sample and have validated that it runs correctly in Excel 2016 on my machine. However, when I go to Excel Online and try to add the add-in (via uploading the manifest from my machine), I get "Your add-in manifest is not valid." I'm not sure what it is about this manifest that's valid on my machine but not in Excel Online. Anyone encountered this before or have any diagnosis ideas? It's somewhat akin to banging my head

How to achieve Freeze Pane in excel using office js api?

北城以北 提交于 2019-12-10 11:39:32
问题 Our add-in create new sheet with ~300 columns. Users want the ability to freeze pane on first 2 columns, so when they move to the right, they still can see the context. Any ideas on how to achieve this? 回答1: This feature is now available in Beta. Please switch to CDN to access this. https://appsforoffice.microsoft.com/lib/beta/hosted/office.js Sample: async function freezeColumns() { await Excel.run(async (context) => { const sheet = context.workbook.worksheets.getItem("Sample"); // Freeze

Outlook Web App add in Dialog Api messageParent not working

北慕城南 提交于 2019-12-10 11:36:41
问题 I am developing a Outlook add in and was checking out the authentication flow (Microsoft login) for my app. I tried using the dialog api to achieve this but was not able to pass message from the dialog to the task pane after successful sign in. index.js: var fullUrl = 'https://localhost:3000/src/templates/auth.html' Office.context.ui.displayDialogAsync(fullUrl, {height: 40, width: 40}, function (result) { console.log("Dialog has initialized. Wiring up events"); _dlg = result.value; console

Change value of a table in content control

╄→гoц情女王★ 提交于 2019-12-10 11:15:33
问题 I created a Word add-in and I insert a table in Word 2016 (version 16.0.7341.2029) using the Word API 1.3 like this: var value = [[3,4],[5,6]]; Word.run(function (ctx) { var table = ctx.document.body.insertTable(value.length, value[0].length, Word.InsertLocation.end, value); var myContentControl = table.insertContentControl(); myContentControl.tag = 'MyTable1'; myContentControl.title = 'This is a table'; return ctx.sync() .then(function () { console.log('Table created'); }).catch(function

Outlook API to forward email as attachment

本秂侑毒 提交于 2019-12-10 11:15:09
问题 I'm currently developing an Outlook Add-in and trying to add a feature to forward an email as an attachment. Can anyone please advice what the simplest way to accomplish it? I cannot find a single API to do it in Outlook Mail REST API reference. Is there any easier way instead of using the 3 different APIs? CreateForwardDraft UpdateMessages SendDraftMessages 回答1: There is an API - addItemAttachmentAsync which can add an email as an attachment. Currently, the forward functionality you

Add-in persistent settings in OSX/Mac

痞子三分冷 提交于 2019-12-10 10:41:51
问题 I am having trouble finding a way to store persistent settings for an office.js add-in on Mac. On windows localStorage works perfect as it saves settings that persist through closing and opening Word. On Mac localStorage does not persist closing and opening Word, not even through a refresh or closing and opening of the add-in. Here is a simple code sample: var settingString = 'mySetting'; var oldValue = localStorage.getItem(settingString); write('oldValue: "' + oldValue + '"'); var d = new

PowerPoint command like insert slide or apply theme equivalent on Office javascript API

微笑、不失礼 提交于 2019-12-10 09:46:40
问题 I'm developing a PowerPoint add-in and in future, it will be publish in Office Store. But it is VSTO project (C# and winforms) which could not be publish. Based on my search, it must be Office Web Add-in project (manifest xml and web pages). I'm trying to convert my development from VSTO to Office Web Add-in but some of functionalities like open presentation, insert slide and apply theme aren't found on the Office.js. Is there equivalent functions in Office.js? or other way? Hopefully someone