Hi I tried to add ListStyles to a RadDocument so that they are shown in the RadRichTextBoxRibbonUi.
That is what I'm doing at the moment but it doesn't works.
foreach
(var style
in
listStyles)
{
ListStyle newList = RadDocument.AddCustomListStyle(style);
RadDocument.ListStyles.Add(newList);
RadDocument.ListManager.RegisterListStyleIfNecessary(newList);
}
That is what I'm doing at the moment but it doesn't works.
5 Answers, 1 is accepted
0
Hello Sebastian,
You should add the ListStyle to the RadDocument using the DocumentList class. The code snippet below demonstrates how to achieve this:
In addition, more information about lists and list styles you can find in the List Styles article in our documentation.
Regards,
Tanya
Telerik
You should add the ListStyle to the RadDocument using the DocumentList class. The code snippet below demonstrates how to achieve this:
RadDocument doc =
new
RadDocument();
ListStyle newListStyle = doc.AddCustomListStyle(list);
DocumentList documentList =
new
DocumentList(newListStyle, doc);
this
.radRichTextBox.Document = doc;
In addition, more information about lists and list styles you can find in the List Styles article in our documentation.
Regards,
Tanya
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
0
Sebastian
Top achievements
Rank 1
answered on 20 Feb 2015, 11:47 AM
public
RadDocument RadDocument
{
get
{
return
this
.editor.Document;
}
set
{
this
.editor.Document = value;
}
}
0
Sebastian
Top achievements
Rank 1
answered on 20 Feb 2015, 11:54 AM
foreach
(var style
in
listStyles)
{
ListStyle newList = RadDocument.AddCustomListStyle(style);
DocumentList documentList =
new
DocumentList(newList, RadDocument);
RadDocument.ListStyles.Add(newList);
RadDocument.ListManager.RegisterListStyleIfNecessary(newList);
}
this
.editor.Document = RadDocument;
0
Accepted
Hi Sebastian,
Please, refer to the snippet below, which is demonstrating how to create a List and add it to the RadDocument:
If you are still experiencing difficulties with this, it would be great if you sent us more details - what is the code for creating the ListStyles, what is not working - it the style not appearing in the document or you get some an error. If it is possible an example project would be great.
I am looking forward to hearing from you.
Regards,
Tanya
Telerik
Please, refer to the snippet below, which is demonstrating how to create a List and add it to the RadDocument:
ListStyle list =
new
ListStyle();
list.StyleLink =
"Numbered"
;
for
(
int
levelIndex = 0; levelIndex < 9; levelIndex++)
{
bool
isEven = (levelIndex % 2) == 0;
ListLevelStyle level =
new
ListLevelStyle();
level.StartingIndex = 1;
level.NumberingFormat = ListNumberingFormat.Decimal;
level.LevelText = isEven ?
"{"
+ levelIndex +
"}."
:
"o"
;
level.ForeColor = Color.FromRgb(34, 144, 233);
level.Indent = 48 + (levelIndex * 24);
list.Levels.Add(level);
}
RadDocument doc =
new
RadDocument();
ListStyle newListStyle = doc.AddCustomListStyle(list);
DocumentList documentList =
new
DocumentList(newListStyle, doc);
If you are still experiencing difficulties with this, it would be great if you sent us more details - what is the code for creating the ListStyles, what is not working - it the style not appearing in the document or you get some an error. If it is possible an example project would be great.
I am looking forward to hearing from you.
Regards,
Tanya
Telerik
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
0
Sebastian
Top achievements
Rank 1
answered on 24 Feb 2015, 08:57 AM
Thanks it works now.
My misstake was that I doesn't set the StartingIndex and the LevelText of the LevelStyle.
My misstake was that I doesn't set the StartingIndex and the LevelText of the LevelStyle.