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
166.9k
I am using word plugin VSTO.
Jun 2 2017 12:24 AM
I created Table of contents with intented.
like
Table of Contents
hi-----------------------------1
bye-------------------------1
somethig----------------1
but I want
Table of Contents
hi-----------------------------1
bye--------------------------1
somethig-------------------1
without space I want please send me the code.
Here what i tried
private void OK_Click(object sender, EventArgs e)
{
if (checkBoxTOC.Checked == true)
{
Microsoft.Office.Interop.Word.Application app = Globals.ThisAddIn.Application;
Microsoft.Office.Interop.Word.Document doc1 = app.ActiveDocument;
object val1 = comboBox1.SelectedItem;
object oUpperHeadingLevel = "1";
object oLowerHeadingLevel = val1;
object missing = null;
object otrue = true;
object ofalse = false;
Selection wordsec = app.Selection;
wordsec.Font.Bold = 1;
wordsec.Font.Size = 14;
wordsec.ParagraphFormat.Alignment = WdParagraphAlignment.wdAlignParagraphCenter;
wordsec.TypeText("Table of Contents\n");
if (checkBoxIndent.Checked == true)
{
TableOfContents toc = doc1.TablesOfContents.Add(wordsec.Range, ref otrue, ref oUpperHeadingLevel, ref oLowerHeadingLevel, ref ofalse, ref missing,
ref otrue, ref otrue, ref missing, ref otrue, ref ofalse, ref ofalse);
wordsec.set_Style(WdBuiltinStyle.wdStyleNormal);
this.Hide();
}
else
{
TableOfContents toc = doc1.TablesOfContents.Add(wordsec.Range, ref ofalse, ref oUpperHeadingLevel, ref oLowerHeadingLevel, ref ofalse, ref missing,
ref otrue, ref otrue, ref missing, ref otrue, ref ofalse, ref otrue);
wordsec.set_Style(WdBuiltinStyle.wdStyleNormal);
this.Hide();
}
}
}
Reply
Answers (
0
)
type Text in combo box, in windows application c#
open the last closed file in word2010