Skip to content

Commit ed48263

Browse files
committed
new KB - Setting Bullet List Indents in RadWordsProcessing
1 parent 385fa1d commit ed48263

File tree

4 files changed

+60
-58
lines changed

4 files changed

+60
-58
lines changed
Loading

knowledge-base/set-bullet-list-indents-radwordsprocessing.md

Lines changed: 57 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -11,81 +11,80 @@ ticketid: 1681870
1111

1212
## Description
1313

14-
When working with bullet lists in RadWordsProcessing documents, you might need to adjust the bullet position and text indentation to meet specific formatting requirements. This knowledge base article also answers the following questions:
14+
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.
1515

16-
- How can I set text indent for bullet lists in RadWordsProcessing?
17-
- How can I adjust the bullet position in RadWordsProcessing lists?
18-
- What are the calculations behind converting device-independent pixels to centimeters for list indents in RadWordsProcessing?
16+
![Bullet Text Indentation](images/bullet-text-indentation.png)
1917

2018
## Environment
2119

22-
<table>
23-
<tbody>
24-
<tr>
25-
<td>Product</td>
26-
<td>RadWordsProcessing for Document Processing</td>
27-
</tr>
28-
</tbody>
29-
</table>
20+
| Version | Product | Author |
21+
| ---- | ---- | ---- |
22+
| 2025.1.205| RadWordsProcessing |[Desislava Yordanova](https://www.telerik.com/blogs/author/desislava-yordanova)|
3023

3124
## Solution
3225

3326
To set the bullet position and text indentation for a bullet list in RadWordsProcessing, follow these steps:
3427

35-
1. Initialize the `RadFlowDocument` and add a section to it.
36-
2. Create a bullet list and configure its levels as needed.
37-
3. Use the `ParagraphProperties.LeftIndent` and `ParagraphProperties.HangingIndent` properties to adjust the bullet position and text indentation.
28+
1. Initialize the [RadFlowDocument]({%slug radwordsprocessing-model-radflowdocument%}) and add a section to it.
29+
2. Create a [bullet list]({%slug radwordsprocessing-concepts-lists%}) and configure its levels as needed.
30+
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.
3831

3932
### Example
4033

4134
```csharp
42-
RadFlowDocument document = new RadFlowDocument();
43-
Section section = document.Sections.AddSection();
44-
45-
document.Lists.Add(ListTemplateType.BulletDefault);
46-
List list = document.Lists.Last();
47-
48-
// Configure the first level of the bullet list
49-
list.Levels[0].NumberTextFormat = "¾";
50-
list.Levels[0].NumberingStyle = NumberingStyle.Bullet;
51-
list.Levels[0].CharacterProperties.FontFamily.LocalValue = new ThemableFontFamily("Wingdings 2");
52-
list.Levels[0].CharacterProperties.FontSize.LocalValue = 16;
53-
list.Levels[0].ParagraphProperties.LeftIndent.LocalValue = 18.933333333333334;
54-
list.Levels[0].ParagraphProperties.HangingIndent.LocalValue = 18.933333333333334;
55-
56-
// Configure the second level of the bullet list
57-
list.Levels[1].NumberTextFormat = "¾";
58-
list.Levels[1].NumberingStyle = NumberingStyle.Bullet;
59-
list.Levels[1].CharacterProperties.FontFamily.LocalValue = new ThemableFontFamily("Wingdings 2");
60-
list.Levels[1].CharacterProperties.FontSize.LocalValue = 13.3333333;
61-
list.Levels[1].ParagraphProperties.LeftIndent.LocalValue = 37.8;
62-
list.Levels[1].ParagraphProperties.HangingIndent.LocalValue = 18.933333333333334;
63-
64-
// Add paragraphs and associate them with list levels
65-
Paragraph paragraph = document.Sections.Last().Blocks.AddParagraph();
66-
paragraph.Inlines.AddRun("Bullet 1");
67-
paragraph.ListId = list.Id;
68-
paragraph.ListLevel = 1;
69-
70-
paragraph = document.Sections.Last().Blocks.AddParagraph();
71-
paragraph.Inlines.AddRun("Bullet 1.1");
72-
paragraph.ListId = list.Id;
73-
paragraph.ListLevel = 2;
35+
RadFlowDocument document = new RadFlowDocument();
36+
Section section = document.Sections.AddSection();
37+
section.PageMargins = new Telerik.Windows.Documents.Primitives.Padding(10);
38+
document.Lists.Add(ListTemplateType.BulletDefault);
39+
List list = document.Lists.Last();
40+
41+
// Configure the first level of the bullet list
42+
list.Levels[0].NumberTextFormat = "¾";
43+
list.Levels[0].NumberingStyle = NumberingStyle.Bullet;
44+
list.Levels[0].CharacterProperties.FontFamily.LocalValue = new ThemableFontFamily("Wingdings 2");
45+
list.Levels[0].CharacterProperties.FontSize.LocalValue = 16;
46+
// Adjust the space between the bullet and the text for the first level
47+
list.Levels[0].ParagraphProperties.LeftIndent.LocalValue = 50; // Bullet position
48+
list.Levels[0].ParagraphProperties.HangingIndent.LocalValue = 20; // Text indent
49+
50+
// Configure the second level of the bullet list
51+
list.Levels[1].NumberTextFormat = "¾";
52+
list.Levels[1].NumberingStyle = NumberingStyle.Bullet;
53+
list.Levels[1].CharacterProperties.FontFamily.LocalValue = new ThemableFontFamily("Wingdings 2");
54+
list.Levels[1].CharacterProperties.FontSize.LocalValue = 14;
55+
// Adjust the space between the bullet and the text for the second level
56+
list.Levels[1].ParagraphProperties.LeftIndent.LocalValue = 100; // Bullet position
57+
list.Levels[1].ParagraphProperties.HangingIndent.LocalValue = 50; // Text indent
58+
59+
// Add paragraphs and associate them with list levels
60+
Paragraph paragraph = document.Sections.Last().Blocks.AddParagraph();
61+
paragraph.Inlines.AddRun("Bullet 1");
62+
paragraph.ListId = list.Id;
63+
paragraph.ListLevel = 0;
64+
65+
paragraph = document.Sections.Last().Blocks.AddParagraph();
66+
paragraph.Inlines.AddRun("Bullet 1.1");
67+
paragraph.ListId = list.Id;
68+
paragraph.ListLevel = 1;
69+
70+
Telerik.Windows.Documents.Flow.FormatProviders.Docx.DocxFormatProvider provider = new Telerik.Windows.Documents.Flow.FormatProviders.Docx.DocxFormatProvider();
71+
string outputFilePath = "output.docx";
72+
File.Delete(outputFilePath);
73+
using (Stream output = File.OpenWrite(outputFilePath))
74+
{
75+
provider.Export(document, output, TimeSpan.FromSeconds(10));
76+
}
77+
78+
Process.Start(new ProcessStartInfo() { FileName = outputFilePath, UseShellExecute = true });
7479
```
7580

76-
**Conversion from device-independent pixels to centimeters:**
7781

78-
The conversion from device-independent pixels (DIP) to centimeters (cm) is based on the formula:
7982

80-
\[ \text{cm} = \frac{\text{DIP}}{96} \times 2.54 \]
81-
82-
For instance, to convert 18.9 DIP to cm:
83-
84-
\[ \text{cm} = \frac{18.9}{96} \times 2.54 = 0.5cm \]
85-
86-
This calculation allows you to set the bullet position and text indentation accurately according to your formatting requirements.
83+
>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:
84+
[ text{cm} = 18.9 / 96 * 2.54 = 0.5cm ].
8785

8886
## See Also
8987

90-
- [Modifying a Paragraph in RadWordsProcessing](https://docs.telerik.com/devtools/document-processing/libraries/radwordsprocessing/model/paragraph#modifying-a-paragraph)
91-
- [Understanding Device Independent Pixels](https://docs.telerik.com/devtools/document-processing/common-information/device-independent-pixels)
88+
- [Style Properties]({%slug radwordsprocessing-concepts-style-properties%})
89+
- [Lists]({%slug radwordsprocessing-concepts-lists%})
90+
- [Device Independent Pixels]({%slug device-independent-pixels%})

libraries/radwordsprocessing/concepts/lists.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,3 +205,5 @@ __Example 6__ demonstrates how you can apply the list created in Steps 1-4 above
205205
* [Styles]({%slug radwordsprocessing-concepts-styles%})
206206

207207
* [Style Properties]({%slug radwordsprocessing-concepts-style-properties%})
208+
209+
* [Setting Bullet List Indents in RadWordsProcessing]({%slug set-bullet-list-indents-radwordsprocessing%})

libraries/radwordsprocessing/concepts/style-properties.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -647,3 +647,4 @@ Following is a list of all available style properties and their default values:
647647
* [Styles]({%slug radwordsprocessing-concepts-styles%})
648648
* [IStyleProperty<T> API Reference](https://docs.telerik.com/devtools/document-processing/api/Telerik.Windows.Documents.Flow.Model.Styles.Core.IStyleProperty-1.html)
649649
* [IStylePropertyDefinition API Reference](https://docs.telerik.com/devtools/document-processing/api/Telerik.Windows.Documents.Flow.Model.Styles.Core.IStylePropertyDefinition.html)
650+
* [Setting Bullet List Indents in RadWordsProcessing]({%slug set-bullet-list-indents-radwordsprocessing%})

0 commit comments

Comments
 (0)