Free Support Forum - aspose.com

DocumentBuilder and Bullet points

Hi Roman,
Are bullet points and numbering likely to be added to DocumentBuilder any time soon?

Cheers
Steve

Hi Steve,

Yes, we are working on this already, it should be ready in a week.

Hi Steve,

Aspose.Word 1.5.2 is available with DocumentBuilder.CellFormat that allows to create bulleted and numbered lists.

I’m trying to figure out the syntax for creating a bullet item, but don’t seem to be able to locate it in the DocumentBuilder.CellFormat Members (Borders, HorizantalMerge, Shading, VerticalAlignment, VerticalMerge, Width don’t look like it)

Thanks,
Ben

Hi Ben,

It is DocumentBuilder.ListFormat.

http://www.aspose.com/Products/Aspose.Word/Api/Aspose.Word.ListFormatMembers.html

Let me know if there is enough options there for your lists or you need more.

I used the following to produce the bullet:
DocumentBuilder builder = new DocumentBuilder(doc);
builder.ListFormat.ApplyBulletDefault();
builder.Writeln(“Bullet 1”);
builder.ListFormat.RemoveNumbers();
builder.Writeln(“w/o bullet”);

The output is:
(a left indent here)? Bullet 1
w/o bullet

Is it possible to have the bullet starting at the 1st column? As in
? Bullet 1
w/o bullet

In Word, when you click on the ‘Bullets’, its starting position is also not at the 1st column
(which is exactly the behaviour of the above code). To make it start at the 1st column, I would select the ‘Decrease Indent’. I’ve tried applying the ListOutdent method, but failed to produce the desired result.

builder.ListFormat.ApplyBulletDefault();
builder.ListFormat.ListOutdent();
builder.ListFormat.ListOutdent();
builder.Writeln(“Bullet 1”);
builder.ListFormat.RemoveNumbers();
builder.Writeln(“w/o bullet”);

Thanks,
Ben

Hi Ben,

My name is Prasenjit. I have also faced the same problem some time before. But I make the code in the following way to solve the problem.

builder.ListFormat.ApplyNumberDefault();
builder.Write(“Bullet 1”);
builder.InsertBreak(BreakType.LineBreak);
builder.InsertBreak(BreakType.LineBreak);
builder.Write(“w/o bullet”);
builder.InsertBreak(BreakType.LineBreak);
builder.InsertParagraph();
builder.ListFormat.RemoveNumbers();


This will display the result as

1. Bullet 1

w/o bullet

You have to replace the ApplyNumberDefault() with ApplyBulletDefault()

That’s it

Regards

Prasenjit

ListIndent and ListOutdent methods are for slightly different purpose. They do the same thing as corresponding methods in MS Word object model - they change list level. In MS Word lists come with preformatted 9 list levels and this is the way to quickly select them. I agree they are named badly, but not by me, I just want to follow the MS Word object model as close as I can.

I will double check why the paragraph gets indented, it should really be the same as in MS Word.

In the meantime you try setting the ParagraphFormat.LeftIndent property.

I’ve checked and DocumentBuilder does exactly what MS Word does. You can try it yourself, the bulleted list items are slightly indented by default - that’s goverend by the default list format.

Let me know if modifying ParagraphFormat.LeftIndent was enough to solve the problem.

I simply might need to add more properties to the ListFormat object to allow better control over the list format.

Hi Prasenjit,

Thanks for your suggestion. But the code is still producing the bullet/number list at a slight indent, making it not align with the starting margin.

Thanks anyway :slight_smile:
Ben

Hi Romank,

Yes, DocumentBuilder does exactly what MS Word does, the bulleted list items are slightly indented by default. Hence I have to select the ‘Decrease Indent’ to un-indent it so that it is inline with the left margin.

I have modified the ParagraphFormat.LeftIndent to achieve a very close result:
builder.ParagraphFormat.LeftIndent = 2.4 * 8; builder.ListFormat.ApplyBulletDefault();
builder.Writeln(“Bullet 1”);
builder.ListFormat.RemoveNumbers();
builder.Writeln(“w/o bullet”);

But I think it is better if there is a equivalent ‘Decrease Indent’ in Aspose.Word, so that in case the left margin of the template has changed, it would be easier to apply the ‘Decrease Indent’ rather than experimenting the appropriate ParagraphFormat.LeftIndent value.

Thanks,
Ben

I will add more control over list formatting.

Hi Roman,

Can you please add something to the list formatting through which we can change the format (font, font color, start number etc.) of the bullet or number. It will give us a great control on that. If you can add some properties through which we can set the start number, then it will be more strong and helpful.

Thanks

Prasenjit

I would like to know, if there is some functionality added to change the format of the bullets or numbers. I haven't found it yet.

Or is there something like the MS Word Listgalleries, to set the bullets or the numbering?

In MS Word, macro code looks like shown below (The properties NumberFormat, NumberPosition, TextPosition, TabPosition, and Font.Name are set by variables):

With m_Word.ListGalleries(WdListGalleryType.wdBulletGallery).ListTemplates(7).ListLevels(1)
.NumberFormat = (ChrW(bulletCharacter)).ToString
.TrailingCharacter = WdTrailingCharacter.wdTrailingTab
.NumberStyle = WdListNumberStyle.wdListNumberStyleBullet
.NumberPosition = m_Word.CentimetersToPoints(iNumberPosition)
.Alignment = WdListLevelAlignment.wdListLevelAlignLeft
.TextPosition = m_Word.CentimetersToPoints(iTextPosition)
.TabPosition = m_Word.CentimetersToPoints(iTabPosition)
.ResetOnHigher = 0
.StartAt = 1
With .Font
.Bold = WdConstants.wdUndefined
.Italic = WdConstants.wdUndefined
.StrikeThrough = WdConstants.wdUndefined
.Subscript = WdConstants.wdUndefined
.Superscript = WdConstants.wdUndefined
.Shadow = WdConstants.wdUndefined
.Outline = WdConstants.wdUndefined
.Emboss = WdConstants.wdUndefined
.Engrave = WdConstants.wdUndefined
.AllCaps = WdConstants.wdUndefined
.Hidden = WdConstants.wdUndefined
.Underline = WdConstants.wdUndefined
.Color = WdColor.wdColorAutomatic
.Size = WdConstants.wdUndefined
.Animation = WdConstants.wdUndefined
.DoubleStrikeThrough = WdConstants.wdUndefined
.Name = bulletFont 'Symbol, Wingdings
End With
.LinkedStyle = ""
End With

The attached Document shows a sample doc-file with customized bullets.

Thanks

Thomas

Hi Thomas,

The only feature that was added since then was Paragraph.ListFormat that allows to modify list formatting of an existing paragraph (before that it was possible to do only via DocumentBuilder).

Sorry custom list formatting has not yet been exposed, but we still plan to add this as soon as we can.

Hi

I would like to know, what "as soos as we can" means: a week, a month, a year? Do you have a forecast for this feature?

Furthermore I have following question about ApplyBulletDefault.

I'm using this function, but I always get the small black point as bullet. But I would like to get a dash (-). I have already changed the normal.dot, which I use to make a new document by Aspose.Word. But that does not help. Is the small black point hardcoded? Or am I making something wrong?

Any suggestions would be appreciated.

Thanks

Thomas

Hi Thomas,

I'm afraid to disappoint you, but no comments on delivery date for this feature. With respect to bullets - applying custom bullets is possible in Word, but not yet implemented in Aspose.Word. We will add this possibility later.

Thank you for understanding.

We are considering Aspose.Word for use in developing a .Net application. I see here that you do not support formatting bullets in Aspose.Word. I looked at the evaluation copy, and while you have a variety of bullets, there doesn't seem to be control of bullets at levels, i.e. using a solid dot at level one as opposed to a hollowed circle for level one. We are developing an app for legal document production, and it is critical that users select numbers or bullets, and be able to format them (start number sequence at 5, etc.) When do you anticipate providing this capability? We will not be able to go forward with this component without that feature. If you do not plan to offer this very soon, are there other components for MS Studio .Net development that you know of that will provide this feature?

I am sorry. We cannot promise anything on this feature except that it will be supported eventually.