Click here to Skip to main content
14,766,373 members
Please Sign up or sign in to vote.
4.00/5 (2 votes)
See more:
Hi,

I want a paragraph count in any shape of publisher. I am working on Microsoft Publisher 2003 and C#.Net 4.0. Used Interop office libraries.
I have done same thing in MS_Publisher 2007 by using following method,
int paraCount = shapeTextFrame.TextFrame.TextRange.ParagraphsCount;


I am not getting equivalent method or any workaround to do the same in 2003 office.

Please send your suggestions.
Posted
Updated 11-Dec-13 3:49am
v2
Comments
Maciej Los 11-Dec-13 9:15am
   
Have you tried with: TextRange.Paragraphs.Count()?
comred 11-Dec-13 10:39am
   
There is no such method available like Paragraphs.Count(). Fyi, I am dealing with Microsoft Publisher interop classes. It has TextRange.Paragraphs() method but it needs two parameters (int start,int length). Which is again of no use. :(
Sayan Bera 11-Dec-13 13:26pm
   
You can get paragraph count of any .docx by using Microsoft.Office.Interop.Word. like
int paragraphs = doc.Paragraphs.Count;
comred 13-Dec-13 3:37am
   
Thanks Sayan, but its about 2003 office. So it will be .doc and .pub files. Nothing like .docx
Sayan Bera 13-Dec-13 23:00pm
   
The code will work for .doc also.

1 solution

I've been visit this link: MS Project 2003 objects[^] and i need to notice that i did found nothing useful ;(

I have an idea. Use Do...While loop. Increase length parameter till Select method will return the error ;)
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900