|
| 1 | +--- |
| 2 | +title: Setting Bullet List Indents in RadWordsProcessing |
| 3 | +description: Learn how to configure bullet list indents including bullet position and text indentation in RadWordsProcessing documents. |
| 4 | +type: how-to |
| 5 | +page_title: How to Set Bullet List Indents in RadWordsProcessing Documents |
| 6 | +slug: set-bullet-list-indents-radwordsprocessing |
| 7 | +tags: radwordsprocessing, document, bullet, list, indent, text, position |
| 8 | +res_type: kb |
| 9 | +ticketid: 1681870 |
| 10 | +--- |
| 11 | + |
| 12 | +## Environment |
| 13 | + |
| 14 | +| Version | Product | Author | |
| 15 | +| ---- | ---- | ---- | |
| 16 | +| 2025.1.205| RadWordsProcessing |[Desislava Yordanova](https://www.telerik.com/blogs/author/desislava-yordanova)| |
| 17 | + |
| 18 | +## Description |
| 19 | + |
| 20 | +When working with bullet lists in [RadWordsProcessing]({%slug radwordsprocessing-overview%}) documents, you might need to adjust the bullet position and text indentation to meet specific formatting requirements. This knowledge base article demonstrates how to set the text indent or adjust the bullet position for bullet lists in RadWordsProcessing. |
| 21 | + |
| 22 | + |
| 23 | + |
| 24 | + |
| 25 | + |
| 26 | +## Solution |
| 27 | + |
| 28 | +To set the bullet position and text indentation for a bullet list in RadWordsProcessing, follow these steps: |
| 29 | + |
| 30 | +1. Initialize the [RadFlowDocument]({%slug radwordsprocessing-model-radflowdocument%}) and add a section to it. |
| 31 | +2. Create a [bullet list]({%slug radwordsprocessing-concepts-lists%}) and configure its levels as needed. |
| 32 | +3. Use the `ParagraphProperties`.[LeftIndent]({%slug radwordsprocessing-concepts-style-properties%}) and `ParagraphProperties`.[HangingIndent]({%slug radwordsprocessing-concepts-style-properties%}) properties to adjust the bullet position and text indentation. |
| 33 | + |
| 34 | +### Example |
| 35 | + |
| 36 | +```csharp |
| 37 | + RadFlowDocument document = new RadFlowDocument(); |
| 38 | + Section section = document.Sections.AddSection(); |
| 39 | + section.PageMargins = new Telerik.Windows.Documents.Primitives.Padding(10); |
| 40 | + document.Lists.Add(ListTemplateType.BulletDefault); |
| 41 | + List list = document.Lists.Last(); |
| 42 | + |
| 43 | + // Configure the first level of the bullet list |
| 44 | + list.Levels[0].NumberTextFormat = "¾"; |
| 45 | + list.Levels[0].NumberingStyle = NumberingStyle.Bullet; |
| 46 | + list.Levels[0].CharacterProperties.FontFamily.LocalValue = new ThemableFontFamily("Wingdings 2"); |
| 47 | + list.Levels[0].CharacterProperties.FontSize.LocalValue = 16; |
| 48 | + // Adjust the space between the bullet and the text for the first level |
| 49 | + list.Levels[0].ParagraphProperties.LeftIndent.LocalValue = 50; // Bullet position |
| 50 | + list.Levels[0].ParagraphProperties.HangingIndent.LocalValue = 20; // Text indent |
| 51 | + |
| 52 | + // Configure the second level of the bullet list |
| 53 | + list.Levels[1].NumberTextFormat = "¾"; |
| 54 | + list.Levels[1].NumberingStyle = NumberingStyle.Bullet; |
| 55 | + list.Levels[1].CharacterProperties.FontFamily.LocalValue = new ThemableFontFamily("Wingdings 2"); |
| 56 | + list.Levels[1].CharacterProperties.FontSize.LocalValue = 14; |
| 57 | + // Adjust the space between the bullet and the text for the second level |
| 58 | + list.Levels[1].ParagraphProperties.LeftIndent.LocalValue = 100; // Bullet position |
| 59 | + list.Levels[1].ParagraphProperties.HangingIndent.LocalValue = 50; // Text indent |
| 60 | +
|
| 61 | + // Add paragraphs and associate them with list levels |
| 62 | + Paragraph paragraph = document.Sections.Last().Blocks.AddParagraph(); |
| 63 | + paragraph.Inlines.AddRun("Bullet 1"); |
| 64 | + paragraph.ListId = list.Id; |
| 65 | + paragraph.ListLevel = 0; |
| 66 | + |
| 67 | + paragraph = document.Sections.Last().Blocks.AddParagraph(); |
| 68 | + paragraph.Inlines.AddRun("Bullet 1.1"); |
| 69 | + paragraph.ListId = list.Id; |
| 70 | + paragraph.ListLevel = 1; |
| 71 | + |
| 72 | + Telerik.Windows.Documents.Flow.FormatProviders.Docx.DocxFormatProvider provider = new Telerik.Windows.Documents.Flow.FormatProviders.Docx.DocxFormatProvider(); |
| 73 | + string outputFilePath = "output.docx"; |
| 74 | + File.Delete(outputFilePath); |
| 75 | + using (Stream output = File.OpenWrite(outputFilePath)) |
| 76 | + { |
| 77 | + provider.Export(document, output, TimeSpan.FromSeconds(10)); |
| 78 | + } |
| 79 | + |
| 80 | + Process.Start(new ProcessStartInfo() { FileName = outputFilePath, UseShellExecute = true }); |
| 81 | +``` |
| 82 | + |
| 83 | + |
| 84 | + |
| 85 | +>tip The conversion from [device-independent pixels]({%slug device-independent-pixels%}) (DIP) to centimeters (cm) is based on the formula:[ text{cm} = text{DIP} / {96} * 2.54 ]. For instance, to convert 18.9 DIP to cm: |
| 86 | +[ text{cm} = 18.9 / 96 * 2.54 = 0.5cm ]. |
| 87 | + |
| 88 | +## See Also |
| 89 | + |
| 90 | +- [Style Properties]({%slug radwordsprocessing-concepts-style-properties%}) |
| 91 | +- [Lists]({%slug radwordsprocessing-concepts-lists%}) |
| 92 | +- [Device Independent Pixels]({%slug device-independent-pixels%}) |
0 commit comments