Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

Description

Excerpt

This class is used to represent a list in a Word document. Lists are part of the BlockElement objects of an Element. Using this class, Lists can be read and written. Lists contain list entries, which are basically paragraphs with additional features.

Signature
C#
C#
 public sealed class List : Element
{signature}{signature:
}
Signature
vb.net
vb.net
Public NotInheritable Class List
		Inherits Element
{signature}
{remarks}To create a new list, use [
Remarks

To create a new list, use Element.InsertListBefore()

|Element.InsertListBefore(Boolean)]

or

[

Element.InsertListAfter()

|Element

.

InsertListAfter(Boolean)].

To

get

an

existing

list,

use

[

Element.GetElements(Element.Type)

|Element.GetElements(Element.Type)]. {remarks} {example} The following sample demonstrates how to create a new list at the end of a document as well as how to get the first list of a document. {code:csharp|title=C#}

.

Example

The following sample demonstrates how to create a new list at the end of a document as well as how to get the first list of a document.

Code Block
csharp
csharp
titleC#


          //--- Insert a numbered list at the end of a new document with one 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 of an existing document
          WordApplication app = new WordApplication();
          Document doc = app.Open(@"C:\sample.doc");
          List lst = doc.GetElements(Element.Type.List)[0];
        
{code} {code:
Code Block
vb.net
|title=
vb.net
titlevb.net
}


          '--- Insert a numbered list at the end of a new document with one 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 of an existing document
          Dim app As New WordApplication()
          Dim doc As Document = app.Open("C:\sample.doc")
          Dim lst As List = doc.GetElements(Element.Type.List)(0)
        
{code} {example} {properties} ||Name||Description|| |[NumEntries|List.NumEntries]|{excerpt-include:List.NumEntries|nopanel=true}| {methods} ||Name||Description|| |[AddEntry(Int32)|
Properties

Name

Description

NumEntries

Excerpt Include
List.NumEntries
List.NumEntries
nopaneltrue
Methods

Name

Description

AddEntry(Int32)

Excerpt Include
List.AddEntry(Int32)

...

List.AddEntry(Int32)

...

nopanel

...

...

Excerpt Include
List.GetEntry(Int32)

...

List.GetEntry(Int32)

...

nopanel

...

...

Excerpt Include
List.GetLevel(Int32)

...

List.GetLevel(Int32)

...

nopanel

...

...

...

Excerpt Include
List.InsertEntry(Int32,

...

Int32)

...

List.InsertEntry(Int32,

...

Int32)

...

nopanel

...

true

...