Skip to content

Added new kb article set-bullet-list-indents-radwordsprocessing #529

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added knowledge-base/images/bullet-text-indentation.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
90 changes: 90 additions & 0 deletions knowledge-base/set-bullet-list-indents-radwordsprocessing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
---
title: Setting Bullet List Indents in RadWordsProcessing
description: Learn how to configure bullet list indents including bullet position and text indentation in RadWordsProcessing documents.
type: how-to
page_title: How to Set Bullet List Indents in RadWordsProcessing Documents
slug: set-bullet-list-indents-radwordsprocessing
tags: radwordsprocessing, document, bullet, list, indent, text, position
res_type: kb
ticketid: 1681870
---

## Description

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.

![Bullet Text Indentation](images/bullet-text-indentation.png)

## Environment

| Version | Product | Author |
| ---- | ---- | ---- |
| 2025.1.205| RadWordsProcessing |[Desislava Yordanova](https://www.telerik.com/blogs/author/desislava-yordanova)|

## Solution

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

1. Initialize the [RadFlowDocument]({%slug radwordsprocessing-model-radflowdocument%}) and add a section to it.
2. Create a [bullet list]({%slug radwordsprocessing-concepts-lists%}) and configure its levels as needed.
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.

### Example

```csharp
RadFlowDocument document = new RadFlowDocument();
Section section = document.Sections.AddSection();
section.PageMargins = new Telerik.Windows.Documents.Primitives.Padding(10);
document.Lists.Add(ListTemplateType.BulletDefault);
List list = document.Lists.Last();

// Configure the first level of the bullet list
list.Levels[0].NumberTextFormat = "¾";
list.Levels[0].NumberingStyle = NumberingStyle.Bullet;
list.Levels[0].CharacterProperties.FontFamily.LocalValue = new ThemableFontFamily("Wingdings 2");
list.Levels[0].CharacterProperties.FontSize.LocalValue = 16;
// Adjust the space between the bullet and the text for the first level
list.Levels[0].ParagraphProperties.LeftIndent.LocalValue = 50; // Bullet position
list.Levels[0].ParagraphProperties.HangingIndent.LocalValue = 20; // Text indent

// Configure the second level of the bullet list
list.Levels[1].NumberTextFormat = "¾";
list.Levels[1].NumberingStyle = NumberingStyle.Bullet;
list.Levels[1].CharacterProperties.FontFamily.LocalValue = new ThemableFontFamily("Wingdings 2");
list.Levels[1].CharacterProperties.FontSize.LocalValue = 14;
// Adjust the space between the bullet and the text for the second level
list.Levels[1].ParagraphProperties.LeftIndent.LocalValue = 100; // Bullet position
list.Levels[1].ParagraphProperties.HangingIndent.LocalValue = 50; // Text indent

// Add paragraphs and associate them with list levels
Paragraph paragraph = document.Sections.Last().Blocks.AddParagraph();
paragraph.Inlines.AddRun("Bullet 1");
paragraph.ListId = list.Id;
paragraph.ListLevel = 0;

paragraph = document.Sections.Last().Blocks.AddParagraph();
paragraph.Inlines.AddRun("Bullet 1.1");
paragraph.ListId = list.Id;
paragraph.ListLevel = 1;

Telerik.Windows.Documents.Flow.FormatProviders.Docx.DocxFormatProvider provider = new Telerik.Windows.Documents.Flow.FormatProviders.Docx.DocxFormatProvider();
string outputFilePath = "output.docx";
File.Delete(outputFilePath);
using (Stream output = File.OpenWrite(outputFilePath))
{
provider.Export(document, output, TimeSpan.FromSeconds(10));
}

Process.Start(new ProcessStartInfo() { FileName = outputFilePath, UseShellExecute = true });
```



>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:
[ text{cm} = 18.9 / 96 * 2.54 = 0.5cm ].

## See Also

- [Style Properties]({%slug radwordsprocessing-concepts-style-properties%})
- [Lists]({%slug radwordsprocessing-concepts-lists%})
- [Device Independent Pixels]({%slug device-independent-pixels%})
2 changes: 2 additions & 0 deletions libraries/radwordsprocessing/concepts/lists.md
Original file line number Diff line number Diff line change
Expand Up @@ -205,3 +205,5 @@ __Example 6__ demonstrates how you can apply the list created in Steps 1-4 above
* [Styles]({%slug radwordsprocessing-concepts-styles%})

* [Style Properties]({%slug radwordsprocessing-concepts-style-properties%})

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