JavaScript API not working for Excel 2013?

I just got a change recommendation report for one add-on I added. It saysYour add-in is not working in the Excel 2013 client on Windows 7 with Internet Explorer 11.

I always tested my add-in in Excel 2016and Excel Online. So I just installed Excel 2013(the version 15.0.4841.1000that includes SP1 ), indeed, the add-in does not work. But it seems that little works ...

For example, the following example function writes hahato a cell A1under Excel Online, while in Excel 2013it does nothing.

function test () {
    Excel.run(function (ctx) {
        var range = ctx.workbook.worksheets.getItem("Sheet1").getRange("A1");
        range.values = [["haha"]];
        return ctx.sync();
    });
}

So does anyone know if the JavaScript API is supported Excel 2013? If not, many experts will not be able to use add-ons because they are still with Excel 2013...

PS: I see that there are many add-ons in the office store that require Excel 2013 or lateror Excel 2013 Service Pack 1 or later. If the JavaScript API does not support Excel 2013how these add-ons were developed (for example, Stock Console )

Edit 1: In my xml manifest:

<?xml version="1.0" encoding="UTF-8"?>
<OfficeApp xmlns="http://schemas.microsoft.com/office/appforoffice/1.1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:bt="http://schemas.microsoft.com/office/officeappbasictypes/1.0" xmlns:ov="http://schemas.microsoft.com/office/taskpaneappversionoverrides" xsi:type="TaskPaneApp">

In mine Home.htmlI have:

<script src="https://appsforoffice.microsoft.com/lib/1/hosted/office.js"></script>

Edit 2: I assume the following setting is equivalent to saying that the add-in should not be used in Excel 2013?

<Hosts>
  <Host Name="Workbook" />
</Hosts>
<Requirements>
  <Sets>
    <Set Name="ExcelApi" MinVersion="1.2"/>
  </Sets>
</Requirements>
<DefaultSettings>
  ...
</DefaultSettings>
+4
source share
2 answers

When you use the Office.js API, you will see that each method is annotated with an API set designation. For instance:

enter image description here

API Office, . http://dev.office.com/reference/add-ins/office-add-in-requirement-sets.

API Office 2016 (ExcelApi, WordApi ..) Excel 2016+ ( Office Online Mac/iOS). API (1.1 vs. 1.2 vs. 1.3) API, RTM Office 2016 ( 1.1 ). , Office 365 ( ). , /MSI Office 2016, API 1.1.

. 100% API, . , "/ " Office, API.

, API ( ), " ". , , , , - API.

: , Excel, . ExcelApi 1.1 . , range.format.columnWidth ExcelApi 1.2. , . , , , API-. ExcelApi 1.1 , JavaScript, , range.format.columnWidth. :.

if (Office.context.requirements.isSetSupported("ExcelApi", 1.2 )
{
   range.format.columnWidth = 25;
}

. (, Office)

+7

Source: https://habr.com/ru/post/1648259/


All Articles