Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable document editing using Office JavaScript API #5074

Closed
rahul-chanana opened this issue Nov 12, 2024 · 4 comments
Closed

Disable document editing using Office JavaScript API #5074

rahul-chanana opened this issue Nov 12, 2024 · 4 comments
Assignees
Labels
Area: Excel Issue related to Excel add-ins Area: PowerPoint Issue related to PowerPoint add-ins Area: Word Issue related to Word add-ins Type: product feature request Office JS ideas that should be posted to aka.ms/m365dev-suggestions (formerly User Voice.)

Comments

@rahul-chanana
Copy link

Hello,

We are developing an Office Add-In (Taskpane) using the Angular framework and are looking for a way to set the document to read-only or disable editing using the Office JavaScript API. Our Add-In performs logic that may take a significant amount of time, and we are seeking a method to lock the document during this process.

We couldn't find any equivalent methods in the available APIs. Is there any way to achieve this?

Thank you in advance for your help!

Expected Behavior

We would like to disable editing of the document temporarily using the Office JavaScript API and enable editing again once the process is complete.

Current Behavior

There doesn't seem to be a method available in the API to disable editing of the document.

Context

We need to perform long-running logic in the add-in, and during this time, we need to disable editing of the document.

Your Environment

  • Platform: Desktop, Office Online
  • Host: Excel, Word, Powerpoint
  • Office version number: 2402
  • Operating System: Windows 11
  • Browser: Chrome, Edge
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs: triage 🔍 New issue, needs PM on rotation to triage ASAP label Nov 12, 2024
@RuizhiSunMS
Copy link
Contributor

Hi @rahul-chanana, thx for your submit.
The excel has a feature called worksheet protection. Is this what you want? https://learn.microsoft.com/en-us/javascript/api/excel/excel.worksheetprotection?view=excel-js-preview

@RuizhiSunMS RuizhiSunMS added Area: Excel Issue related to Excel add-ins Area: Word Issue related to Word add-ins Area: PowerPoint Issue related to PowerPoint add-ins Needs: author feedback Waiting for author (creator) of Issue to provide more info and removed Needs: triage 🔍 New issue, needs PM on rotation to triage ASAP labels Nov 12, 2024
@RuizhiSunMS RuizhiSunMS self-assigned this Nov 12, 2024
@rahul-chanana
Copy link
Author

Hi @RuizhiSunMS,

Thanks for your reply. I’ve tested the worksheet protection, and it’s working well. We now need similar APIs for Word and Powerpoint as well. Is there any way to achieve this functionality in Word and Powerpoint as well?

@microsoft-github-policy-service microsoft-github-policy-service bot added Needs: attention 👋 Waiting on Microsoft to provide feedback and removed Needs: author feedback Waiting for author (creator) of Issue to provide more info labels Nov 12, 2024
@RuizhiSunMS RuizhiSunMS removed the Needs: attention 👋 Waiting on Microsoft to provide feedback label Nov 12, 2024
@RuizhiSunMS
Copy link
Contributor

Hi @RuizhiSunMS,

Thanks for your reply. I’ve tested the worksheet protection, and it’s working well. We now need similar APIs for Word and Powerpoint as well. Is there any way to achieve this functionality in Word and Powerpoint as well?

I'm investigating.

@EsterBergen
Copy link

@rahul-chanana -

Currently, the Office JavaScript API does not provide a direct method to disable document editing or set a PowerPoint presentation to read-only model.

However, you might consider alternative approaches, such as:

  1. Prompting the user to save and close the document before performing operations that require the document to be in a non-editable state.
  2. Using dialogs or notifications to inform users not to make changes during certain operations.
  3. Implementing custom logic to track changes and revert them if necessary, though this can be complex and may not fully prevent editing.

If you'd like to request a feature - please make the request here Microsoft 365 Developer Platform Ideas Forum. Feature requests on are considered when we go through our planning process. Thanks for highlighting this!

@EsterBergen EsterBergen reopened this Nov 12, 2024
@RuizhiSunMS RuizhiSunMS added the Type: product feature request Office JS ideas that should be posted to aka.ms/m365dev-suggestions (formerly User Voice.) label Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Excel Issue related to Excel add-ins Area: PowerPoint Issue related to PowerPoint add-ins Area: Word Issue related to Word add-ins Type: product feature request Office JS ideas that should be posted to aka.ms/m365dev-suggestions (formerly User Voice.)
Projects
None yet
Development

No branches or pull requests

3 participants