Description
This class is used to represent an entry in a List inside a Word document. A list entry in Word is basically a numbered paragraph.
C#
public sealed class ListEntry : Paragraph
vb.net
Public NotInheritable Class ListEntry Inherits Paragraph
Remarks
The following sample gets the first ListEntry object of a List.
To create a new list entry, use List.AddEntry(). To get an existing list entry, use Element.GetElements(Element.Type.ListEntry) to get all elements of type ListEntry.
Examples
The following sample demonstrates how to create a new list entry at the end of a list as well as how to get the first list entry of an existing list.
C#
//--- Create a new list with a new list entry
WordApplication app = new WordApplication();
Document doc = app.Create();
List lst = doc.InsertListAfter(true);
lst.AddEntry(0);
lst.InsertTextAfter("First list entry.", false);
//--- Get the first list entry of an existing list
WordApplication app = new WordApplication();
Document doc = app.Open(@"C:\sample.doc");
ListEntry entry =
(ListEntry)doc.GetElements(Element.Type.ListEntry)[0];
vb.net
'--- Create a new list with a new list entry
Dim app As New WordApplication()
Dim doc As Document = app.Create()
Dim lst As List = doc.InsertListAfter(True)
lst.AddEntry(0)
lst.InsertTextAfter("First list entry.", False)
'--- Get the first list entry of an existing list
Dim app As New WordApplication()
Dim doc As Document = app.Open("C:\sample.doc")
Dim entry As ListEntry = _
doc.GetElements(Element.Type.ListEntry)(0)
Properties
Name |
Description |
|---|---|
Sets or returns a String representing the bullet text of this entry as it would show up if it was opened in Word. |
|
Sets or returns an int representing the indent level for this list entry. |
Methods
Name |
Description |
|---|---|
Sets the number of this list entry to "1" and renumbers all subsequent entries in the List. This method splits the current ListEntry and all subsequent list entries into a new List. |
