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.8k
How to search Hidden Styles in word using VSTO in c#
Feb 6 2019 12:57 AM
I am not able to search Hidden Styles in word using VSTO c#.
I have two styles "
Instructions
" and "
Guidance
" in my word document.
Here I used code:
public
bool
CheckInstructionText()
{
try
{
istoCheckInstructionsandGuidence =
false
;
bool
ischeckforInstructions =
false
;
bool
ischeckforGuidence =
false
;
Microsoft.Office.Interop.Word.Application app = Globals.ThisAddIn.Application;
Microsoft.Office.Interop.Word.Document doc1 = app.ActiveDocument;
Microsoft.Office.Interop.Word.Selection wordSelection = app.ActiveWindow.Selection;
Find fnd = doc1.Content.Find;
//.Range.Find;
fnd.ClearFormatting();
fnd.Font.Hidden = 1;
fnd.Replacement.ClearFormatting();
fnd.Text =
""
;
fnd.Replacement.Text =
""
;
fnd.Forward =
true
;
fnd.Wrap = Microsoft.Office.Interop.Word.WdFindWrap.wdFindContinue;
fnd.Format =
true
;
fnd.set_Style(
"Instructions"
);
ischeckforInstructions = fnd.Execute();
fnd.ClearFormatting();
fnd.Font.Hidden = 1;
fnd.Replacement.ClearFormatting();
fnd.Text =
""
;
fnd.Replacement.Text =
""
;
fnd.Forward =
true
;
fnd.Wrap = Microsoft.Office.Interop.Word.WdFindWrap.wdFindContinue;
fnd.Format =
true
;
fnd.set_Style(
"Guidance"
);
ischeckforGuidence = fnd.Execute();
if
(ischeckforInstructions || ischeckforGuidence)
{
istoCheckInstructionsandGuidence =
true
;
}
}
catch
{
}
return
istoCheckInstructionsandGuidence;
}
Please anyone know the answer please reply me.
Thanks
Reply
Answers (
0
)
dynamically generated textbox value not updating
how to create ai like jarvis iron man?