Coder Social home page Coder Social logo

Excel close is not working about office-js HOT 10 OPEN

ishanig11 avatar ishanig11 commented on August 10, 2024
Excel close is not working

from office-js.

Comments (10)

shanshanzheng-dev avatar shanshanzheng-dev commented on August 10, 2024

Hi @ishanig11 Thanks for reporting this issue. I run this code and context workbook is getting closed. Could you please try again? Thanks.
async function run() {
await Excel.run(async (context) => {
context.workbook.close(Excel.CloseBehavior.skipSave);
await context.sync();
});
}
image

from office-js.

ishanig11 avatar ishanig11 commented on August 10, 2024

@shanshanzheng-dev : I am using similar code but for me no error no message. Also my action button is present under task pane.
Is it possible for you to share this sample application? And also video of behavior?

from office-js.

shanshanzheng-dev avatar shanshanzheng-dev commented on August 10, 2024

Hi @ishanig11, I use script lab to run this code, you can check this video:

Screen.Recording.2024-06-17.at.07.41.08.mov

from office-js.

ishanig11 avatar ishanig11 commented on August 10, 2024

I used same code from function getting called in executeFunction. But not working.

from office-js.

shanshanzheng-dev avatar shanshanzheng-dev commented on August 10, 2024

Hi @ishanig11 This is my Excel online build number: 16.0.17809.42308. And this is my test code on script lab:
$("#run").on("click", () => tryCatch(run));

async function run() {
await Excel.run(async (context) => {
context.workbook.close(Excel.CloseBehavior.skipSave)

await context.sync();

});
}

/** Default helper for invoking an action and handling errors. */
async function tryCatch(callback) {
try {
await callback();
} catch (error) {
// Note: In a production add-in, you'd want to notify the user through your add-in's UI.
console.error(error);
}
}

from office-js.

ishanig11 avatar ishanig11 commented on August 10, 2024

Thank you @shanshanzheng-dev . It worked. But is there anyway to avoid that popup?

from office-js.

shanshanzheng-dev avatar shanshanzheng-dev commented on August 10, 2024

do you meaning this below picture? I think this is by design and we can't avoid it.
image

from office-js.

ishanig11 avatar ishanig11 commented on August 10, 2024

Yes, this dialog.

from office-js.

shanshanzheng-dev avatar shanshanzheng-dev commented on August 10, 2024

Hi @ishanig11, I'm afraid that we can't avoid this dialog, this is by design. Thanks.

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.