TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
chetan Allipur
NA
541
169.1k
How to get fastest Heading Number from Word document.
Dec 4 2017 3:53 AM
How to get fastest Heading Number from Word document.
My code is getting too slow when we have more than 20 pages.
Here is my code
foreach (Paragraph paragraph in Globals.ThisAddIn.Application.ActiveDocument.Paragraphs)
{
if ((paragraph.Range.get_Style() as Style) != null)
{
if ((paragraph.Range.get_Style() as Style).NameLocal.StartsWith("Heading 1") || (paragraph.Range.get_Style() as Style).NameLocal.StartsWith("Heading 2") ||
(paragraph.Range.get_Style() as Style).NameLocal.StartsWith("Heading 3") || (paragraph.Range.get_Style() as Style).NameLocal.StartsWith("Heading 4") ||
(paragraph.Range.get_Style() as Style).NameLocal.StartsWith("Heading 5") || (paragraph.Range.get_Style() as Style).NameLocal.StartsWith("Heading 6") ||
(paragraph.Range.get_Style() as Style).NameLocal.StartsWith("Heading 7") || (paragraph.Range.get_Style() as Style).NameLocal.StartsWith("Heading 8") ||
(paragraph.Range.get_Style() as Style).NameLocal.StartsWith("Heading 9"))
{
string GetSections = paragraph.Range.ListFormat.ListString;
if (GetSections != "")
{
cbGetSections.Items.Add(GetSections);
RibbonTab.ConstantValue.Add(GetSections);
}
}
}
}
We are using each paragraph that's why it is getting slow.
Please send me the fastest code to get Heading Numbers.
Reply
Answers (
0
)
Crystal report is not loading from the specified path
how to count duplicate values in datagridview c# forms