var doc = new DocumentModel();
doc.Sections.Add(
new Section(doc,
new Paragraph(doc,
new Run(doc, "First"),
new SpecialCharacter(doc, SpecialCharacterType.Tab),
new Run(doc, "Second"),
new SpecialCharacter(doc, SpecialCharacterType.Tab),
new Run(doc, "Third"),
new SpecialCharacter(doc, SpecialCharacterType.Tab),
new Run(doc, "Fourth"),
new SpecialCharacter(doc, SpecialCharacterType.LineBreak),
new SpecialCharacter(doc, SpecialCharacterType.Tab),
new SpecialCharacter(doc, SpecialCharacterType.Tab),
new SpecialCharacter(doc, SpecialCharacterType.Tab))
{
ParagraphFormat = new ParagraphFormat()
{
Tabs =
{
new TabStop(1000, TabStopAlignment.Left, TabStopLeader.Dot),
new TabStop(2000, TabStopAlignment.Center, TabStopLeader.Hyphen),
new TabStop(3000, TabStopAlignment.Right, TabStopLeader.Underscore)
}
}
}));
var path = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "TabStops.docx");
doc.Save(path);
System.Diagnostics.Process.Start(path);// Create a new empty document.
var doc = new DocumentModel();
// Define document content and paragraph formatting in one code statement.
doc.Sections.Add(
new Section(doc,
new Paragraph(doc,
// Add two lines of text: first with text and tabs, second with only tabs - so tab stop position, tab stop alignment and tab stop leader values can be observed more closely.
new Run(doc, "First"),
new SpecialCharacter(doc, SpecialCharacterType.Tab),
new Run(doc, "Second"),
new SpecialCharacter(doc, SpecialCharacterType.Tab),
new Run(doc, "Third"),
new SpecialCharacter(doc, SpecialCharacterType.Tab),
new Run(doc, "Fourth"),
new SpecialCharacter(doc, SpecialCharacterType.LineBreak),
new SpecialCharacter(doc, SpecialCharacterType.Tab),
new SpecialCharacter(doc, SpecialCharacterType.Tab),
new SpecialCharacter(doc, SpecialCharacterType.Tab))
{
ParagraphFormat = new ParagraphFormat()
{
Tabs =
{
// Define three tab stops, with different alignments and leader characters, each ending 1000 points after the previous one.
new TabStop(1000, TabStopAlignment.Left, TabStopLeader.Dot),
new TabStop(2000, TabStopAlignment.Center, TabStopLeader.Hyphen),
new TabStop(3000, TabStopAlignment.Right, TabStopLeader.Underscore)
}
}
}));
// Document will be saved on the Desktop.
var path = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "TabStops.docx");
// Save the document.
doc.Save(path);
// Open the document in Microsoft Word.
System.Diagnostics.Process.Start(path);
Dim doc = New DocumentModel()
Dim paragraphFormat = New ParagraphFormat()
paragraphFormat.Tabs.Add(New TabStop(1000, TabStopAlignment.Left, TabStopLeader.Dot))
paragraphFormat.Tabs.Add(New TabStop(2000, TabStopAlignment.Center, TabStopLeader.Hyphen))
paragraphFormat.Tabs.Add(New TabStop(3000, TabStopAlignment.Right, TabStopLeader.Underscore))
doc.Sections.Add(
New Section(doc,
New Paragraph(doc,
New Run(doc, "First"),
New SpecialCharacter(doc, SpecialCharacterType.Tab),
New Run(doc, "Second"),
New SpecialCharacter(doc, SpecialCharacterType.Tab),
New Run(doc, "Third"),
New SpecialCharacter(doc, SpecialCharacterType.Tab),
New Run(doc, "Fourth"),
New SpecialCharacter(doc, SpecialCharacterType.LineBreak),
New SpecialCharacter(doc, SpecialCharacterType.Tab),
New SpecialCharacter(doc, SpecialCharacterType.Tab),
New SpecialCharacter(doc, SpecialCharacterType.Tab)) With
{
.ParagraphFormat = paragraphFormat
}))
Dim path = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "TabStops.docx")
doc.Save(path)
System.Diagnostics.Process.Start(path)' Create a new empty document.
Dim doc = New DocumentModel()
' Define three tab stops, with different alignments and leader characters, each ending 1000 points after the previous one.
Dim paragraphFormat = New ParagraphFormat()
paragraphFormat.Tabs.Add(New TabStop(1000, TabStopAlignment.Left, TabStopLeader.Dot))
paragraphFormat.Tabs.Add(New TabStop(2000, TabStopAlignment.Center, TabStopLeader.Hyphen))
paragraphFormat.Tabs.Add(New TabStop(3000, TabStopAlignment.Right, TabStopLeader.Underscore))
' Define document content and paragraph formatting in one code statement.
' Add two lines of text: first with text and tabs, second with only tabs - so tab stop position, tab stop alignment and tab stop leader values can be observed more closely.
doc.Sections.Add(
New Section(doc,
New Paragraph(doc,
New Run(doc, "First"),
New SpecialCharacter(doc, SpecialCharacterType.Tab),
New Run(doc, "Second"),
New SpecialCharacter(doc, SpecialCharacterType.Tab),
New Run(doc, "Third"),
New SpecialCharacter(doc, SpecialCharacterType.Tab),
New Run(doc, "Fourth"),
New SpecialCharacter(doc, SpecialCharacterType.LineBreak),
New SpecialCharacter(doc, SpecialCharacterType.Tab),
New SpecialCharacter(doc, SpecialCharacterType.Tab),
New SpecialCharacter(doc, SpecialCharacterType.Tab)) With
{
.ParagraphFormat = paragraphFormat
}))
' Document will be saved on the Desktop.
Dim path = System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "TabStops.docx")
' Save the document.
doc.Save(path)
' Open the document in Microsoft Word.
System.Diagnostics.Process.Start(path)