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

RichApi.Error: GeneralException still occurs when updating styles #4908

Open
Anya1304 opened this issue Sep 19, 2024 · 4 comments
Open

RichApi.Error: GeneralException still occurs when updating styles #4908

Anya1304 opened this issue Sep 19, 2024 · 4 comments
Assignees
Labels
Area: Word Issue related to Word add-ins Needs: attention 👋 Waiting on Microsoft to provide feedback Type: product bug Bug in the Office Add-ins platform or Office JavaScript APIs

Comments

@Anya1304
Copy link

Anya1304 commented Sep 19, 2024

We're still seeing the error from issue #4463 . Can you let us know when the fix will be available, or if there are any workarounds we can try in the meantime?

Your Environment

  • Platform: PC desktop
  • Host: Word
  • Office version number: Version 2408 (Build 17928.20156)
  • Operating System: Windows 11

Expected behavior

delete custom styles and hide built-in ones before inserting new document using context.document.insertFileFromBase64(base64String, "Replace", { importStyles: true }); will ensure the Styles Gallery shows styles identical to the specific document being inserted, without errors.

Current behavior

When we delete custom styles and hide built-in ones before switching to a new document, an error occurs after several switches through documents. The more documents have styles, the faster the error occurs.

Steps to reproduce

  1. Create several documents with a lot of styles
  2. Open first document using context.document.insertFileFromBase64(base64String, "Replace", { importStyles: true });
  3. Delete all custom styles and hide built-in styles from the current styles
              //delete all non-built-in styles
              if (!style.builtIn) {
                style.delete();
              }
              //remove built-in styles from styles gallery
              else if (style.visibility) {
                style.set({ visibility: false });
              }  
  1. Open the next document using context.document.insertFileFromBase64(base64String, "Replace", { importStyles: true }); and repeat the algorithm. It takes many switches to see the error.

Additional details

I created a snippet containing the logic described above. Using this snippet in ScriptLab, switch through documents as shown in the video. It may take about 10-15 switches for the error to occur.

Useful logs

[ERROR]: Error:
{
   "stack": "RichApi.Error: GeneralException
 at new n (https://appsforoffice.microsoft.com/lib/1/hosted/word-win32-16.01.js:25:269237)
 at i.processRequestExecutorResponseMessage (https://appsforoffice.microsoft.com/lib/1/hosted/word-win32-16.01.js:25:333684)
 at https://appsforoffice.microsoft.com/lib/1/hosted/word-win32-16.01.js:25:331747",
   "message": "GeneralException",
   "name": "RichApi.Error",
   "code": "GeneralException",
   "traceMessages": [],
   "innerError": null,
   "debugInfo": {
       "code": "GeneralException",
       "message": "GeneralException",
       "errorLocation": "Document.insertFileFromBase64",
       "statement": "var insertFileFromBase64 = root.insertFileFromBase64(...);",
       "surroundingStatements": [
           "...",
           "var v382 = context.root._getObjectByReferenceId(\"033!00001B2C\");",
           "v382.delete();",
           "var v383 = context.root._getObjectByReferenceId(\"033!00001B2D\");",
           "v383.delete();",
           "var root = context.root;",
           "// >>>>>",
           "var insertFileFromBase64 = root.insertFileFromBase64(...);",
           "// <<<<<",
           "// Instantiate {insertFileFromBase64}"
       ],
       "fullStatements": [
           "Please enable config.extendedErrorLogging to see full statements."
       ]
   },
   "httpStatusCode": 500
}
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs: triage 🔍 New issue, needs PM on rotation to triage ASAP label Sep 19, 2024
@michelleranmsft michelleranmsft added Needs: attention 👋 Waiting on Microsoft to provide feedback Type: product bug Bug in the Office Add-ins platform or Office JavaScript APIs Area: Word Issue related to Word add-ins and removed Needs: triage 🔍 New issue, needs PM on rotation to triage ASAP labels Sep 19, 2024
@shanshanzheng-dev
Copy link
Contributor

Hi @Anya1304 Thanks for reporting this issue. We'll actively investigate and report back if we have a suggestion for you.

@lamotik
Copy link

lamotik commented Sep 20, 2024

@shanshanzheng-dev please keep us updated, this issues is pretty important for us to be fixed

@shanshanzheng-dev
Copy link
Contributor

Hi @lamotik OK, we'll update once we have new progress. Thanks

@Anya1304
Copy link
Author

Anya1304 commented Sep 26, 2024

Hi @jipyua @Searion @shanshanzheng-dev, if you understand our problem, maybe you have some ideas about alternatives/workarounds we can try to deal with this behavior?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Word Issue related to Word add-ins Needs: attention 👋 Waiting on Microsoft to provide feedback Type: product bug Bug in the Office Add-ins platform or Office JavaScript APIs
Projects
None yet
Development

No branches or pull requests

6 participants