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
167.6k
How to get the Numbered List Styles using word VSTO.
Jun 16 2017 3:31 AM
I want to get all Numbered list styles in word using VSTO code.
I want sample like this
1. example ----List leve1
a. hello------List level2
b demo ------List level3
i. bye-------List level4
ii. hi
2. Example1
a. hello1
i. bye1
Above sample format I want .
Here is my code
object missing = System.Reflection.Missing.Value;
Microsoft.Office.Interop.Word.Application app = Globals.ThisAddIn.Application;
app.Visible = true;
// whatever is selected will be turned into a numbered list.
object n = 1;
ListTemplate template =
app.ListGalleries[WdListGalleryType.wdOutlineNumberGallery].ListTemplates.get_Item(ref n);
Microsoft.Office.Interop.Word.ListLevel level = template.ListLevels[1];
level.NumberFormat = "%1.";
level.TrailingCharacter = WdTrailingCharacter.wdTrailingTab;
level.NumberStyle = WdListNumberStyle.wdListNumberStyleLowercaseLetter;
level.NumberPosition = app.InchesToPoints(0.25f);
level.Alignment = WdListLevelAlignment.wdListLevelAlignLeft;
level.TextPosition = app.InchesToPoints(0.25f);
level.TabPosition = (float)WdConstants.wdUndefined;
level.ResetOnHigher = 0;
level.StartAt = 1;
level.LinkedStyle = "";
template.Name = "";
object bContinuePrevList = true;
object applyTo = WdListApplyTo.wdListApplyToSelection;
object defBehavior = WdDefaultListBehavior.wdWord10ListBehavior;
app.Selection.Range.ListFormat.ApplyListTemplateWithLevel(
template, ref bContinuePrevList,
ref applyTo, ref defBehavior, ref missing);
Reply
Answers (
2
)
Datagridview Checkbox remains unchecked in childform
how to set datagridview's row number form textbox? c#