Message-ID: <1488820643.8545.1711649512740.JavaMail.web05$@web05> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_8544_419312350.1711649512740" ------=_Part_8544_419312350.1711649512740 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
List Element.InsertListAfter(boolean numbered)=20
Inserts an empty list at the end of the specified Element. Pass tr= ue to the method to create a numbered list, and false to create a bulleted = list.
List Element.InsertListBefore(boolean numbered)=20
Inserts an empty list at the beginning of the specified Element. P= ass true to the method to create a numbered list, and false to create a bul= leted list.
List Position.InsertList(boolean numbered)=20
Inserts an empty list at a specified position within an Element. A= Position object represents a cursor. Pass true to the method to create a n= umbered list, and false to create a bulleted list.
Before adding a list to your file, you must create a content region in w= hich to insert the list. Each editable region in a Word file is represented= by an Element object, or an object that extends Element, such as a Documen= t object.
WordApplication wwapp =3D new WordApplication(); Document doc =3D wwapp.Create();=20
To insert an empty list, use one of the methods listed at the beginning = of this section, for example:
//--- The boolean parameter specifies whether the //--- list is numbered (true) or bulleted (false). List numberedList =3D doc.InsertListAfter(true);=20
Next, create list entries. To add a new entry, call either List.AddEntry= or List.InsertEntry.
//--- AddEntry's parameter specifies the 0-based //--- indent level at which to insert the new entry. A list //--- may contain up to 9 levels, so the deepest level //--- is 8. The following inserts the first list entry, at //--- the top list level. ListEntry firstListEntry =3D numberedList.AddEntry(0); //--- InsertEntry's first parameter specifies the 0-based //--- position in the list at which to insert the new entry //--- (for the first entry this parameter should be O, //--- for the second 1, and so on). The second parameter //--- specifies the 0-based level of the new entry. A list //--- may contain up to 9 levels, so the deepest level //--- is 8. The following inserts the second list entry, at //--- the top list level. ListEntry secondListEntry =3D numberedList.InsertEntry(1, 0);=20
To add text to a list entry call one of the Element class's InsertTextAf= ter or InsertTextBefore methods. You can apply a font to the text by passing a Font = object to InsertTextAfter or InsertTextBefore. The following lines create a= Font object that we will use later when adding text to the paragraph:
Font listFont =3D doc.CreateFont(); listFont.FontName =3D "Times New Roman"; listFont.FontSize =3D 10;=20
The method InsertTextAfter takes a string and inserts it at the end of t= he list entry. The method's second parameter specifies a Font object (creat= ed above) to apply to the text.
firstListEntry.InsertTextAfter("OfficeWriter for Word"= , listFont); secondListEntry.InsertTextAfter("OfficeWriter for Excel", listFont);=20
You can access existing lists through the Element.Elements property.
//--- Open an existing Word file and get the first //--- table. WordApplication wwapp =3D new WordApplication(); Document doc =3D wwapp.Open(@"C:\sample.doc"); List firstList =3D doc.GetElements(Element.Type.List)[0];=20