0
votes

I am creating a Add-in for word 2007 Using VSTO2008 with Microsoft.Office.Interop.Word assembly .In the active document,I

have 3 paragraphs and
each paragraphs contain no of lists(Bulleted list).I Want to count the total list with in each paragraph(Not entire

document).for this I was used following
code but not get the right output.

Word.Document dc = Globals.ThisAddIn.Application.ActiveDocument;
int count = dc.ListParagraphs.Count;

//getting all bulleted list total within the document,but i want only within the

paragraph

int count=dc.lists.count;

int count = dc.Paragraphs[1].Range.ListParagraphs.Count;

//Getting Zero value in count variable


I need to replace text of last but one row/item of bulleted list.

OR

How do I get how many bulleted rows or lines or numbered list items are in a particular bulleted list ? Also need to access

the individual row/line of a selected bullted list. Since we want to code to replace particular text of a last but one row of

bullted list.

1

1 Answers

1
votes

try

Word.Document dc = Globals.ThisAddIn.Application.ActiveDocument;
int count = dc.Lists[1].ListParagraphs.Count;