MigraDoc Bullet List (holes)

六眼飞鱼酱① 提交于 2019-12-05 07:26:59
Vive la déraison

Simply set the LeftIndent of the MyBulletList style to match the first tab stop, set the FirstLineIndent to a negative value to make space for the bullet - and that's all.

To keep it simple: the minimum requirements (assuming "paragraph" is the result of AddParagraph):

paragraph.Format.LeftIndent = "2.5cm";
paragraph.Format.FirstLineIndent = "-0.5cm";
paragraph.Format.ListInfo.ListType = ListType.BulletList1;

Here is sample code that uses a style (the style was previously created, the code snippet only modifies it):

style = styles["BulletList"];
style.ParagraphFormat.RightIndent = 12;
style.ParagraphFormat.TabStops.ClearAll();
style.ParagraphFormat.TabStops.AddTabStop(Unit.FromCentimeter(2.5), TabAlignment.Left);
style.ParagraphFormat.LeftIndent = "2.5cm";
style.ParagraphFormat.FirstLineIndent = "-0.5cm";
style.ParagraphFormat.SpaceBefore = 0;
style.ParagraphFormat.SpaceAfter = 0;

As mentioned before: the whole "trick" is setting LeftIndent and use a negative FirstLineIndent to position the bullet.

To add a style, get the Styles from the Document and call:

document.Styles.AddStyle("Bulletlist", "Normal");
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!