officedev / office-js-docs Goto Github PK
View Code? Open in Web Editor NEW[ARCHIVED] Microsoft Office Add-ins API Reference Documentation
Home Page: https://docs.microsoft.com/javascript/api/overview/office
[ARCHIVED] Microsoft Office Add-ins API Reference Documentation
Home Page: https://docs.microsoft.com/javascript/api/overview/office
The images appear fine in GitHub but not on dev.office.com. https://dev.office.com/docs/add-ins/design/ui-elements/ui-elements
I am testing my add-in on different platforms
my add-in contains the following code to do runtime checks in my JavaScript code
if (Office.context.requirements.isSetSupported("WordApi", 1.1) { // Code }
my test shows that the above if statement receives a TRUE in Word Online, meaning Word Online fully supports office.js version 1.1 , which i don't believe is true.
my add-in also contains the following code
var searchResults = context.document.body.search('to*n', {matchWildCards: true});
this code works perfectly in Office 2016, but does not in Word Online, this code can only get me an error like this :{"name":"OfficeExtension.Error","code":"GeneralException","me ssage":"This browser does not support the requested API.","traceMessages":[],"debugInfo":{},"stack":"GeneralExcepti on: This browser does not support the requested API.\n at Anonymous function
I went to check Word online, and i found Word Online does not support WildCards search as Office 2016, so I guess maybe this is the reason why I got the above error message.
Is there a way to detemine wherther this code is running in Word 2016 or Word Online, so that I could let my code fail in Word Online
source code of my add-in can be found in my repository "text-effect-autocorrection"
The Excel object exposes a run method but it is not clear what (if any) value such as a promise is returned. Are other methods exposed on Excel? It would be good to document it.
I have used both context.document.body.insertOoxml) and paragraph.insertOoxml() to replace text in a paragraph successfully.
However if the paragraph is originally bulleted then I find that Word changes it to a numbered list paragraph when some text in the paragraph is replaced. In other word the list/numbering information is not preserved correctly.
This happens on Windows, Mac and iOS.
Has anyone experienced this? Is it a known issue? Is there a workaround? Is there any preprocessing I can perform on the Ooxml to prevent this from happening?
The last example before the error code table is copied exactly from the example before it. It should show the application of a formula across a range. Instead, it shows the application of a value across the range - the same as the previous example.
Hi,
I am using Visual Studio 2015 Update 2 and am having some issues getting Angular 2 to work with Typescript. I was just trying to get a basic sample going based on the Angular 2 quickstart https://angular.io/docs/ts/latest/quickstart.html.
Is what I am doing supported by Office apps(Angular 2 + Typescript + SystemJS + RxJS)?
Thanks in advance!
When using JavaScript to get the OOXML body (bodyOOXML.value) as a string using the following code, the word/numbering.xml package is not included:
Word.run(function (context) {
// Create a proxy object for the document body.
var body = context.document.body;
// Queue a commmand to get the OOXML contents of the body.
var bodyOOXML = body.getOoxml();
// Synchronize the document state by executing the queued commands,
// and return a promise to indicate task completion.
return context.sync().then(function () {
console.log("Body OOXML contents: " + bodyOOXML.value);
});
})
.catch(function (error) {
console.log("Error: " + JSON.stringify(error));
if (error instanceof OfficeExtension.Error) {
console.log("Debug info: " + JSON.stringify(error.debugInfo));
}
});
The word/styles.xml, word/fontTable.xml, etc. are included but without the numbering package we cannot recreate the number formats. Any help appreciated!
Is this possible maybe with the RangeFormat? Been trying to figure out, need to convert an old VBA application and can't tell if merging cells is supported or not.
Just launched my tutorial add in inside Word 2016, but nothing happens when I click the button. No warnings or popups. Any tips? I suspect this maybe an Internet Options security issue. Even tried decreasing the security settings to the minimum (Medium), but still no candy/
All code examples showing how to read/write data from content controls manipulate only the first element of the list. Please provide examples manipulating multiple elements. For example: get all content controls HTML, insert HTML into a group of content controls, etc.
We'll need this before we publish live.
The new docs in their current state on dev.office.com need some improvements to match the same level of help as the previous docs on MSDN. Here's just a few the issues encountered so far with the new docs that should be addressed: 1) you can't open links in new tab or window as you get "page not found" (this is the most frustrating problem) and many links are just broken, 2) the docs don't take up my entire window width on my large screen monitor (I have the space, use it), 3) the altering color of table rows (white/blue) makes it less readable and is distracting and text should be top-aligned, 4) the browser back/forward buttons break most of the time, 5) I have no idea where I am in the "big picture" when navigating around, 6) the left menu and the "Docs" vs. "API Reference" at the top are a lot less helpful than the MSDN version, 7) the trailing color of hovering on the left menu is clever but really distracting and the selected nav item is too dark, 8) the syntax coloring of examples is less "bright" than the MSDN version and harder to read and also when you copy/paste the example into OneNote for example it pastes as just red and black, 9) the "Send to OneNote" formatting is not good and just as important, because of #1 issue above, all the links are broken when clicked on in OneNote, 10) overall it took me at least 4 times as long to find the information I was looking for because of "new tab" issue and it seems that I have to scroll a lot more because the left nav is not dynamic to the current context (ex. if I am viewing Table Object the props and methods of the table object should be available on the left nav)
Sorry if this is harsh but it was a very frustrating day trying to find and organize information that I should have been able to do in a couple of hours. I'm sure the docs are a work-in-progress but generally they just don't seem ready for prime time yet.
Please re-activate the MSDN docs until these issues can be resolved.
Thanks.
The word-add-ins.md document states that the document applies to "Word 2016, Word for iPad, Word for Mac." Does "Word for Mac" refer to Word 2016 for Mac or to an older version? The instructions, starting with step 7, do not appear to pertain to the new Word 2016 for Mac. Is there an example of how to use an add-in with that version?
In the tutorial, Taskpane app manifest version is 1.1 but it is still using old Capabilities element in the manifest. Can you please update as Hosts
Thanks
Hello,
Would it be possible to see the browser console for js errors in a task pane for Word 2016? The console is priceless for js debugging...
PS: I noticed the snippet explorer addin provides trace output.
The CustomXMLParts is listed as a shared API resource, but it is only currently available for Word.
The documentation currently says it is not available for Word Online, but our experience is that it is working for us in our developer (edge) tenant.
When will it work for Excel and PowerPoint as this is functionality we have had in the COM API for years now.
Thanks,
Angus
I noticed the SourceLocation requires an https location. SSL can be pain to setup and maintain (until this comes out https://letsencrypt.org/ :) ), so it would be great if we could host addons on onedrive. Or maybe Azure with a discount? :P
The page here with new Excel 1.2 features list has an entry: "Row Height, Column Width and Autofit". The link on that item seems to be incorrect, it reads: https://github.com/OfficeDev/office-js-docs/blob/ExcelJs_1.2_OpenSpec/excel/resources/range.md#mergeacross-boolean
Note the "mergeacross-boolean".
I could not find any doc on "Row Height, Column Width and Autofit" in the Range or Worksheet doc.
It seems that every link in the "new" docs on dev.office.com when attempting to "open in new tab" or "new browser window" results in Page Not Found.
Please don't take away this functionality of the browser for the docs. Opening every link in the same tab makes reading the docs very difficult. Please go back to the old way.
Examples
https://dev.office.com/docs/reference/shared/bindings.releasebyidasync.htm
https://dev.office.com/docs/docs/design/add-in-design.htm
...pretty much every link
Thanks.
Looks like some browser security settings need to be modified for the addin to execute the javascript? Nothing happens when I click on "Allow blocked content"
PS I tried setting the security to the lowest in "Internet Options" both for internet and intranet.
Even though the documentation does call out that it applies to Word 2016, it wasn't clear to people at the AngularConnect hackathon that it doesn't apply to Word online. Maybe just a note about this at the top of the page.
Step 7 talks about a network folder. Can I use a local C:... folder?
https://github.com/OfficeDev/office-js-docs/blob/master/word/word-add-ins.md
PS Looks like it is as Office only accepts URLs for trusted addin locations...This helped http://windows.microsoft.com/en-us/windows-vista/share-files-and-folders-over-the-network-from-windows-vista-inside-out
These two Microsoft technologies are already used heavily in Angular2, which we are currently designing around, and we would love to have support for them in this API as well.
In general, it'll be good to lead with some background on what add-in does. e.g., Though the product data is hard-coded, it could have been read from a database/external source. The chart creation helps with analysis of the products data, etc.
Instead of
"To create the add-in, you essentially need to create a web app and an XML manifest file that tells where your web app is located and how you want it to appear within Excel"
-try-
"1. Create web app and XML manifest file that describes the web application's location and its appearance within Excel "
Same applies to other cases such as "Let's now create the...", "Believe it or not, we’ve only just begun exp..."
The html file references a file "Office.css", but later there is only code for Common.css. Is Office.css something predefined, or was it just forgotten in the description?
File: build-your-first-excel-add-in.md
When trying to run home.html from the BoilerPlate demo, I am getting this js error in the console, and this error probably prevents the buttons from working. Any tips?
HTTP404: NOT FOUND - The server has not found anything matching the requested URI (Uniform Resource Identifier).
(XHR): GET - http://ajax.aspnetcdn.com/ajax/jQuery/jquery.min.map
Hello! Please tell me when the methods of Range.getOoxml() and Range.insertOoxml() will be implemented for Word Online? I checked these by Word API 1.1 and get an exception "Not implemented".
We have a use case involving many tables in the same sheet (that can be refreshed periodically with data of variable size). Currently, the Table object only supports deleting/adding rows or columns which will attempt to shift everything to the right or below. If the tables are staggered in the sheet, this can cause the refresh/paste operations to fail.
We would therefore like to modify the size of existing tables without shifting neighboring cells. Is it possible to expose the ListObject.resize method in the Excel API to resize Tables?
Not sure if this is the right place to ask, but i give it a try. When can we expect to get support for Word Online with the Word.js capabilties.
Thanks.
Any plans for Outlook JS API like Word and Excel?
I would love to enable my adding for Outlook messages as well in addition to Word.
In the sample code for InsertOoxml (https://github.com/OfficeDev/office-js-docs/blob/master/word/word-add-ins-javascript-reference/range.md) the comment "https://github.com/OfficeDev/office-js-docs/blob/master/word/word-add-ins-javascript-reference/range.md" is incorrect. The content to be inserted is NOT Office Open XML; it's the old WordProcessingML from Word 2003. It's wrong to lead people to believe that inserting Word Open XML is so simple - it's not. The code is much more verbose and complex. This comment needs to be corrected!
I noticed the snippets catch console errors, but wondered if we could somehow enable the browser console. I find the browser version much better :)
Hi,
I am creating an add-in for excel using office js api (typescript + angular). I can see that there is a property called "protection" for worksheet and range types in the office-js.ts file. But the values are never available. I am not able to find any documentation regarding this property. I am wondering whether the properties are added only in the typescript file and not yet added in the actual office js api. Can you please give me a sample on how to retrieve and set the protection values.
Protection property in Worksheet class:
/**
*
* Returns sheet protection object for a worksheet.
*
* [Api set: ExcelApi 1.2]
*/
protection: Excel.WorksheetProtection;
Protection property in RangeFormat class:
/**
*
* Returns the format protection object for a range.
*
* [Api set: ExcelApi 1.2]
*/
protection: Excel.FormatProtection;
This is how I tried loading the values and did not succeed. The property always returns undefined.
Cell protection:
for (var i = 0; i < sourceRange.rowCount; i++) {
cellFormats[i] = [];
//http://stackoverflow.com/questions/35647790/get-individual-cell-formats-in-excel-using-office-js/35658073#35658073
for (var j = 0; j < sourceRange.columnCount; j++) {
if (sourceRange.getCell(i, j) != undefined && sourceRange.getCell(i, j) != null) {
cellFormats[i][j] = sourceRange.getCell(i, j).load(["format/", "format/protection/", "format/protection/locked"]);
}
Worksheet protection:
var protection = ctx.workbook.worksheets.getItem(worksheetName).load("protection");
Thanks,
Anoop.
http://dev.office.com/docs/ throws a 404 because it has a trailing slash but this should be handled.
Multiple pages throughout the documentation. Minor bug, more of a fit and finish type of thing.
The dropdown on every headings on MSDN (e.g. "Properties" on https://msdn.microsoft.com/EN-US/library/office/mt598672.aspx) don't do anything. Collapsing them doesn't hide anything which makes me think the hierarchy between the headings and the content isn't properly set up.
Page: https://msdn.microsoft.com/en-us/library/office/mt616493.aspx
The first resource has a broken link.
We need to remove the preview label and make sure command docs are up to date. Self Assigning.
first, please understand a pool command of my English.
(I would like my question to be conveyed .)
I am just curios.
Can i use WebSocket or Socket.io in add-ins?
Also, How about React.js?
Table.apply method param - please provide potential values for the 'method' parameter; describe how to get this from the fields property.
The "https://dev.office.com/docs/add-ins/overview/requirements-for-running-office-add-ins" page needs rework. For example it doesn't include info about add-in commands, also the last paragraph seems redundant with the overview topic. Overall someone needs to take a good look and review that page.
Thx for the fantastic tutorial at https://github.com/OfficeDev/office-js-docs/blob/master/word/word-add-ins.md
How do I generate a GUID at step 5? I hope I dont have to install Visual Studio for that. Can I use some of the tools mentioned here? http://stackoverflow.com/questions/105034/create-guid-uuid-in-javascript
PS I am playing with this one https://www.guidgenerator.com
In OfficeUI.md, close() is listed direct children of Office.context.ui, but the actual implementation only supports close() as a member of the dialog object returned by the dusplayDialogAsync callback function via the asyncResult.value
Can we get user data such as Live.com email via the JS api? Would love a snippet :) I would like to associate in app purchases to the logged in user, or prompt the user to login if they are anonymous. Would be convenient if I could use the Live.com user account.
The following files aren't linked in the TOC.
develop/office javascript api/support for content and task pane add-ins
excel/format tables in add-ins for Excel
Also, is the office mix content supposed to be under PowerPoint?
Hello,
Would love to pass in a regular expression instead of plain text for search (https://github.com/OfficeDev/office-js-docs/blob/master/word/word-add-ins-javascript-reference/body.md#searchsearchtext-string-searchoptions-paramtypestringssearchoptions)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.