-
Notifications
You must be signed in to change notification settings - Fork 120
Word.List.paragraphs.items includes paragraphs from ALL lists of the document, rather than just from the list reference #6602
Copy link
Copy link
Open
Labels
Area: WordIssue related to Word add-insIssue related to Word add-insNeeds: attention 👋Waiting on Microsoft to provide feedbackWaiting on Microsoft to provide feedback
Description
Environment
- Platform: PC
- Host: Word
- Word version number: Microsoft® Word for Microsoft 365 MSO (Version 2602 Build 16.0.19725.20126) 64-bit
- Operating System: Win 11 Version 10.0.26200 Build 26200
Expected behavior
Word.List.paragraphs.items should only include paragraphs that are members of the list, not entire document.
Current behavior
Word.List.paragraphs.items retrieves paragraphs from ALL lists of the document.
Reproduction:
3 Content Controls (CCRef1-3) with 1 list per CC

Javascript:
Office.onReady(async (info) => {
if (info.host !== Office.HostType.Word) return console.error("Wrong Host Enviornment. Expected Microsoft Word.");
document.querySelector("button").addEventListener("click", async function (evnt) {
await Word.run(async (documentContext) => {
// Get all Content controls of the doc
const allCCs = documentContext.document.contentControls.load("items, tag, lists");
await documentContext.sync();
// Load items on list of each CC
for (const cc of allCCs.items) {
cc.lists.load("items");
}
await documentContext.sync();
// Count How many Lists and How many paragraphs in each list
for (const cc of allCCs.items) {
console.log(`${cc.tag} - List Amount in CC: ${cc.lists.items.length}`);
const ccList = cc.lists.getFirstOrNullObject();
ccList.load("isNullObject, paragraphs, paragraphs/items");
await documentContext.sync();
if (ccList.isNullObject) throw new Error("No List found!");
console.log(`"${cc.tag}" 's List Paragraphs Length: ${ccList.paragraphs.items.length}`);
}
});
});
});HTML:
...
<div>
<button type="button">How Many Items?</button>
</div>
...Result:

Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Area: WordIssue related to Word add-insIssue related to Word add-insNeeds: attention 👋Waiting on Microsoft to provide feedbackWaiting on Microsoft to provide feedback