GithubHelp home page GithubHelp logo

Comments (19)

phtai avatar phtai commented on August 10, 2024 1

Hi @forlemon & @rmrodrigues, we found the problem is that Office Online fails to parse a version number that consists of less than four parts (like 2.12). The version number in the add-in manifest should be in a format like 2.12.0.0

We have checked-in a fix for this but it needs a few weeks to deploy. In the mean time, you can just change the version number in the add-in manifest to a supported format, and it should fix the problem.

from office-js.

nunocv avatar nunocv commented on August 10, 2024

Made a simple Test.
This:

            $scope.test = function () {
                Excel.run(function (context) {
                    var ws = context.workbook.worksheets.getActiveWorksheet();
                    var cel = ws.getCell(1, 1);
                    cel.load('columnIndex');
                    return context.sync().then(function () {
                        var a = ws.getCell(2, 2);
                        var txt = cel.columnIndex;
                        a.values = txt;
                        return context.sync();
                    })
                });
            }

Does Not work on Excel Online, Throws the same exception, "GeneralException"
Just to clarify, $scope is just an angular object needed to call this function when the button is clicked in the Panel on Excel.

from office-js.

Zlatkovsky avatar Zlatkovsky commented on August 10, 2024

@forlemon , thanks for showing the code sample.

I ran it in Office Online using Script Lab, and it worked fine. So I'm guessing that it's not a framework bug per se, but rather the way that you're hooking up Angular.

It sounds somewhat akin to the issue described in https://stackoverflow.com/a/44118441/678505. Do you have an "Office.initialized()" somewhere on the page, and are you sure that it's firing?

from office-js.

nunocv avatar nunocv commented on August 10, 2024

Yes I have an "Office.initialized()".
I've even put it like this:

Office.initialize = function (reason) {
    $(document).ready(function () {
        $('#test').click(function test() {
            Excel.run(function (context) {
                var ws = context.workbook.worksheets.getActiveWorksheet();
                var cel = ws.getCell(1, 1);
                cel.load('columnIndex');
                return context.sync().then(function () {
                    var a = ws.getCell(2, 2);
                    var txt = cel.columnIndex;
                    a.values[0][0] = txt;
                    return context.sync();
                })
            });
        });
    });
};

And it still throws GeneralException after this line "return context.sync().then(function () {"
I couldn't make it even work on ScriptLab, no results and no console errors or message.
But sideloading the add in, and executing that function on a simple button, throws the error once again.

from office-js.

Zlatkovsky avatar Zlatkovsky commented on August 10, 2024

In Script Lab, you don't need an Office.initialize. Having one would actually throw Script Lab off. Script Lab is meant as a simplified playground, where you only need to write in the "interesting" bit of code -- whereas we take care of the backend infrastructure.

Just to check: if you had only the inner code in Script Lab, does it work for you in Office Online?

    $('#test').click(function () {
        Excel.run(function (context) {
            var ws = context.workbook.worksheets.getActiveWorksheet();
            var cel = ws.getCell(1, 1);
            cel.load('columnIndex');
            return context.sync().then(function () {
                var a = ws.getCell(2, 2);
                var txt = cel.columnIndex;
                a.values[0][0] = txt;
                return context.sync();
            })
        });
    });

from office-js.

nunocv avatar nunocv commented on August 10, 2024

It throws an error saying the values property is not loaded
It shows this output(it's in portuguese though):

Unhandled Promise rejection: A propriedade "values" não está disponível. Antes de ler o valor da propriedade, chame o método de carregamento no objeto contentor e chame "context.sync()" no contexto de pedido associado. ; Zone: <root> ; Task: Promise.then ; Value: PropertyNotLoaded: A propriedade "values" não está disponível. Antes de ler o valor da propriedade, chame o método de carregamento no objeto contentor e chame "context.sync()" no contexto de pedido associado. {...} Error: A propriedade "values" não está disponível. Antes de ler o valor da propriedade, chame o método de carregamento no objeto contentor e chame "context.sync()" no contexto de pedido associado.
    at r.ZoneAwareError (https://script-lab.azureedge.net/bundles/polyfills.2e9078c49c55fa18c57b.bundle.js:1:77489)
    at new r (https://appsforoffice.microsoft.com/lib/1/hosted/excel-web-16.00.js:21:283042)
    at t.throwIfNotLoaded (https://appsforoffice.microsoft.com/lib/1/hosted/excel-web-16.00.js:21:335136)
    at k.get [as values] (https://appsforoffice.microsoft.com/lib/1/hosted/excel-web-16.00.js:21:379271)
    at https://script-lab-runner.azureedge.net/compile/page:15:27
    at ZoneDelegate.invoke (https://script-lab.azureedge.net/bundles/polyfills.2e9078c49c55fa18c57b.bundle.js:1:85192)
    at Zone.run (https://script-lab.azureedge.net/bundles/polyfills.2e9078c49c55fa18c57b.bundle.js:1:80018)
    at https://script-lab.azureedge.net/bundles/polyfills.2e9078c49c55fa18c57b.bundle.js:1:77231
    at ZoneDelegate.invokeTask (https://script-lab.azureedge.net/bundles/polyfills.2e9078c49c55fa18c57b.bundle.js:1:85935)
    at Zone.runTask (https://script-lab.azureedge.net/bundles/polyfills.2e9078c49c55fa18c57b.bundle.js:1:80709)
    at drainMicroTaskQueue (https://script-lab.azureedge.net/bundles/polyfills.2e9078c49c55fa18c57b.bundle.js:1:75411)
    at ZoneTask.invoke (https://script-lab.azureedge.net/bundles/polyfills.2e9078c49c55fa18c57b.bundle.js:1:86983)
Error: Uncaught (in promise): PropertyNotLoaded: A propriedade "values" não está disponível. Antes de ler o valor da propriedade, chame o método de carregamento no objeto contentor e chame "context.sync()" no contexto de pedido associado.
Error: A propriedade "values" não está disponível. Antes de ler o valor da propriedade, chame o método de carregamento no objeto contentor e chame "context.sync()" no contexto de pedido associado.
    at r.ZoneAwareError (https://script-lab.azureedge.net/bundles/polyfills.2e9078c49c55fa18c57b.bundle.js:1:77489)
    at new r (https://appsforoffice.microsoft.com/lib/1/hosted/excel-web-16.00.js:21:283042)
    at t.throwIfNotLoaded (https://appsforoffice.microsoft.com/lib/1/hosted/excel-web-16.00.js:21:335136)
    at k.get [as values] (https://appsforoffice.microsoft.com/lib/1/hosted/excel-web-16.00.js:21:379271)
    at https://script-lab-runner.azureedge.net/compile/page:15:27
    at ZoneDelegate.invoke (https://script-lab.azureedge.net/bundles/polyfills.2e9078c49c55fa18c57b.bundle.js:1:85192)
    at Zone.run (https://script-lab.azureedge.net/bundles/polyfills.2e9078c49c55fa18c57b.bundle.js:1:80018)
    at https://script-lab.azureedge.net/bundles/polyfills.2e9078c49c55fa18c57b.bundle.js:1:77231
    at ZoneDelegate.invokeTask (https://script-lab.azureedge.net/bundles/polyfills.2e9078c49c55fa18c57b.bundle.js:1:85935)
    at Zone.runTask (https://script-lab.azureedge.net/bundles/polyfills.2e9078c49c55fa18c57b.bundle.js:1:80709)
    at drainMicroTaskQueue (https://script-lab.azureedge.net/bundles/polyfills.2e9078c49c55fa18c57b.bundle.js:1:75411)
    at ZoneTask.invoke (https://script-lab.azureedge.net/bundles/polyfills.2e9078c49c55fa18c57b.b

If I load the property it just doesn't do nothing, no change on the cell (2,2) and no message on the console.

from office-js.

Zlatkovsky avatar Zlatkovsky commented on August 10, 2024

Ah, right. Sorry, this code is different from what you'd once had, though :-)

Instead of a.values[0][0] = txt, you need a.values = [[txt]]. There is something special about array-handling in particular, where you have to set the entire array at once, not piece-meal. More info here: http://buildingofficeaddins.com/array-properties/.

Try it now with a.values = [[txt]]

from office-js.

nunocv avatar nunocv commented on August 10, 2024

It worked on ScriptLab!
But the same function in the context of the Add-In, this happens:
image

It does not it the breakpoint.
But this does not happen on Desktop Excel

from office-js.

Zlatkovsky avatar Zlatkovsky commented on August 10, 2024

I am not sure what is happening.

If you can create the absolute minimal repro project, I can try to take a look. By minimal, I mean something that has little extraneous stuff, and where I can just do a simple "npm install" "npm start" or equivalent to run it locally. It seems like it's something in your hookup between your framework code and the Office code, but I can try to help if I see the full source code and can debug it on my computer.

from office-js.

nunocv avatar nunocv commented on August 10, 2024

I've created a Visual Studio Excel Add In project that only has this html and this javascript. Published it on a server and ran the Manifest on excel Online. Same exception:

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=Edge" />
    <title>Excel Add-In: Xporter Snippets</title>

    <script src="Scripts/jquery-3.1.1.js" type="text/javascript"></script>
    <script src="Scripts/FabricUI/MessageBanner.js" type="text/javascript"></script>
    <script src="Scripts/jquery.fabric.min.js"></script>
    <script src="Scripts/angular.js"></script>
    <link href="Content/Office.css" rel="stylesheet" type="text/css" />
    <script src="https://appsforoffice.microsoft.com/lib/1.1/hosted/office.js" type="text/javascript"></script>
    <link rel="stylesheet" href="Content/fabric.min.css" />
    <link rel="stylesheet" href="Content/fabric.components.css" />
    <script src="Scripts/Jquery.NavBar.js"></script>

    <!-- To enable offline debugging using a local reference to Office.js, use:                        -->
    <!-- <script src="Scripts/Office/MicrosoftAjax.js" type="text/javascript"></script>  -->
    <!-- <script src="Scripts/Office/1/office.js" type="text/javascript"></script>  -->

    <link href="ExcelSnippets.css" rel="stylesheet" type="text/css" />
    <script src="ExcelSnippets.js" type="text/javascript"></script>

    <!-- For the Office UI Fabric, go to https://aka.ms/office-ui-fabric to learn more. -->
    <!-- To enable the offline use of Office UI Fabric, use: -->

</head>
<!-- Angular controller that has all the scope variables to be used to create the web page -->
<body >
        <button class="ms-Button" style="margin-top:20%;" id="test">
            <span class="ms-Button-label">TEST</span>
        </button>
</body>

</html>
(function () {
    "use strict";

    // The initialize function must be run each time a new page is loaded.
Office.initialize = function (reason) {
    $(document).ready(function () {
        $('#test').click(function test() {
            Excel.run(function (context) {
                var ws = context.workbook.worksheets.getActiveWorksheet();
                var cel = ws.getCell(1, 1);
                cel.load('columnIndex');
                var a = ws.getCell(2, 2);
                a.load('values');
                return context.sync().then(function () {
                    var txt = cel.columnIndex;
                    a.values = [[txt]];
                    return context.sync();
                })
            });
        });
    });
};
})();

from office-js.

Zlatkovsky avatar Zlatkovsky commented on August 10, 2024

I reached out for someone on our team to help investigate.

from office-js.

Zlatkovsky avatar Zlatkovsky commented on August 10, 2024

(For the record, for internal folks: this is ICM issue 57542289)

from office-js.

nunocv avatar nunocv commented on August 10, 2024

Is there any news regarding this?

from office-js.

phtai avatar phtai commented on August 10, 2024

@forlemon I have tried your simplified code on Excel Online, but cannot repro the issue. The snippet completes successfully without any exceptions.

I wonder if you could give us more details about it?

image

Normally, by executing the simplified snippet you gave, it will send in a couple of requests to ExecuteRichApiRequest and GetRangeContent. Could you please turn-on the Network capture just before you click the TEST button, and see if those requests are completed successfully? And could you please give us the correlation IDs from the headers of each responses, so that we can diagnose the issue more easily?

from office-js.

nunocv avatar nunocv commented on August 10, 2024

CorrelationId: "09c326b9-b646-407d-82a1-89b5cbe13bfc"
image
image

from office-js.

phtai avatar phtai commented on August 10, 2024

@forlemon Thank you for your response. We found this is likely to be a bug in the Office Online. We are working to get it fixed.

from office-js.

nunocv avatar nunocv commented on August 10, 2024

Any updates?

from office-js.

rmrodrigues avatar rmrodrigues commented on August 10, 2024

Hi team,
Is there any progress on this? We are creating a new add-in and we are unable to finish some feature because we are depending on this fix.
Could you give us some update?

Cheers,
Rui Rodrigues

from office-js.

soorajhealthplotter avatar soorajhealthplotter commented on August 10, 2024

I am also having the same bug

My Code is

Excel.run((context) ->
sheet = context.workbook.worksheets.getItem(s_name)
response_data = {"A1"=>"1000","A2"=>"1001","B1"=>"1000","B2"=>"1001","C1"=>"1000","C2"=>"1001"} # similary 54000+ records
angular.forEach response_data, (key, value) ->
range = sheet.getRange(key)
range.values = [[ value ]]
context.sync().then ->
console.log("Data synchronized")
return
).catch (error) ->
console.log 'Error: ' + error

My Excel version is

excel_version

I am having issue is Excel Online

from office-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.