Formatted bullets and text

Hi,

I've spent 3 hours now just trying to get this bullet and text problem fixed. I can't get the bullets to be at a proper distance from the bullets, and I can't get the text below it to indent correctly.

I've attached the template (Template.doc), the code that I use (bulletcode.txt), the file that is generated (CreateAsposeReport.doc), and what I would like that file to really look like (CorrectSection.doc.)

Do you have any advice that could help me?

Thanks,

Stella

The key of making the necessary indentation for list item is using two ParagraphFormat properties: FirstLineIndent and LeftIndent. To find values for these properties, create the item list with desired indentation in MS Word and use Format | Reveal Formatting menu command to view formatting for the currently selected text. There, in Paragraph | Indentation group you can see the following properties (if set): Before, Hanging/First line, After. These properties have the following relation to Aspose.Words ParagraphFormat properties:

when FirstLineIndent is positive:

Before = FirstLineIndent + LeftIndent;

Hanging = - FirstLineIndent;

After = RightIndent;

when FirstLineIndent is negative:

Before = LeftIndent;

First line = FirstLineIndent;

After = RightIndent.

First line

is shown in MS Word's Reveal Formatting when FirstLineIndent is positive. Hanging is shown when FirstLineIndent is negative. You can use this relationships to figure out what values should be assigned to Aspose.Words ParagraphFormat indentation properties.

Hope this clarifies things a bit.

And here is the code that can be used to make the formatting of your generated document exactly match with the model:

Public Sub TestFormatBulletsAndText()
' Open the document.
Dim doc As Document = ...
Dim builder As DocumentBuilder = New DocumentBuilder(doc)
builder.MoveToBookmark("Good")
WriteTextBlock(builder, "Header 1", "Your text 1.")
WriteTextBlock(builder, "Header 2", "Your text 2.")
WriteTextBlock(builder, "Header 3", "Your text 3.")
' Save the document
Doc.Save ...
End Sub

Private Sub WriteTextBlock(ByVal builder As DocumentBuilder, ByVal header As String, ByVal content As String)
builder.Font.Name = "Arial"
builder.Font.Size = 10
builder.ListFormat.ApplyBulletDefault()
builder.Bold = True
builder.ParagraphFormat.FirstLineIndent = -18
builder.ParagraphFormat.LeftIndent = 36
builder.ParagraphFormat.RightIndent = 10.8
builder.ParagraphFormat.SpaceBefore = 6
builder.Writeln(header)
builder.ListFormat.RemoveNumbers()
builder.Bold = False
builder.ParagraphFormat.FirstLineIndent = 0
builder.ParagraphFormat.LeftIndent = 36.7
builder.ParagraphFormat.RightIndent = 10.8
builder.ParagraphFormat.SpaceBefore = 6
builder.ParagraphFormat.SpaceAfter = 6
builder.Writeln(content)
End Sub

Hope this helps,