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

addRows method not working for multiple tables #4040

Open
src107 opened this issue Jan 23, 2024 · 3 comments
Open

addRows method not working for multiple tables #4040

src107 opened this issue Jan 23, 2024 · 3 comments
Assignees
Labels
Area: Word Issue related to Word add-ins Status: in backlog Issue is being tracked in the backlog but timeline for resolution is unknown

Comments

@src107
Copy link

src107 commented Jan 23, 2024

The method addRows of Table Class fails if we try to add rows for multiple tables where each table is present inside a content control in the word document.
Below is the screenshot of the error
image

Your Environment

  • Platform [PC desktop, Mac, iOS, Office on the web]: Desktop
  • Host [Excel, Word, PowerPoint, etc.]: Word
  • Operating System: Mac/Windows

Expected behavior

It should add rows for all the tables present in the document.

Current behavior

It adds rows to the first table and throws an error while adding rows for the next tables.

Steps to reproduce

  1. Execute the code Link using ScriptLab.
  2. Click the Insert table button multiple times to insert multiple tables in the document.
  3. Click the Add rows button.
  4. Click the Add rows using cc which addRows looping through the content of the content controls.

Link to live example(s)

  1. Script lab Link
  2. https://learn.microsoft.com/en-us/javascript/api/word/word.table?view=word-js-preview#word-word-table-addrows-member(1)

Provide additional details

  1. Script lab Link
@microsoft-github-policy-service microsoft-github-policy-service bot added the Area: Word Issue related to Word add-ins label Jan 23, 2024
@microsoft-github-policy-service microsoft-github-policy-service bot added the Needs: attention 👋 Waiting on Microsoft to provide feedback label Jan 23, 2024
@Searion
Copy link

Searion commented Jan 24, 2024

@src107 Thanks for reporting. For this scenario, you can try to invoke context.sync() in every loop like this to solve this error.
image

@src107
Copy link
Author

src107 commented Jan 24, 2024

@src107 Thanks for reporting. For this scenario, you can try to invoke context.sync() in every loop like this to solve this error. image

Hi @Searion, Thanks for the reply. It is not recommended to do context.sync() inside a loop, please check this article from microsoft https://learn.microsoft.com/en-us/office/dev/add-ins/concepts/correlated-objects-pattern.

Can't we do it with one context.sync(), the workaround you provided is very performance inefficient.

@Searion
Copy link

Searion commented Jan 26, 2024

@src107
Thanks for reporting this issue.
It has been put on our backlog<Bug#8693742> for internal track. We will keep track of this issue and let you know if there are any updates.

@zhenhuangMSFT zhenhuangMSFT added Status: in backlog Issue is being tracked in the backlog but timeline for resolution is unknown and removed Needs: attention 👋 Waiting on Microsoft to provide feedback labels Jan 26, 2024
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 Status: in backlog Issue is being tracked in the backlog but timeline for resolution is unknown
Projects
None yet
Development

No branches or pull requests

3 participants