This is a migrated thread and some comments may be shown as answers.

Problem with TxtFormatProvider and bullet lists

3 Answers 142 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
hwsoderlund
Top achievements
Rank 1
hwsoderlund asked on 30 Jun 2011, 04:56 PM
The RadDocument below contains bullet lists. When I convert it to plain text using the TxtFormatProvider, the bullets are replace by the dreaded "questionmark with square around it" character. Is there anyway that you could change it so that bullets are converted to star ( * ) characters instead? Or is there another way to solve this? I have attached a screen shot of what the plain text output looks like in UltraEdit.


<t:RadDocument xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
               xmlns:t="clr-namespace:Telerik.Windows.Documents.Model;assembly=Telerik.Windows.Documents"
               version="1.1"
               DefaultPageLayoutSettings="816,1056"
               LayoutMode="Flow"
               PageViewMargin="10,10"
               ParagraphDefaultSpacingAfter="0">
    <t:RadDocument.Lists>
        <t:ListSerializationData ID="1"
                                 StyleID="1" />
    </t:RadDocument.Lists>
    <t:RadDocument.ListStyles>
        <t:ListStyle ID="1">
            <t:ListLevelStyle FontFamily="Symbol"
                              LevelText=""
                              NumberingFormat="Bullet"
                              StartingIndex="1" />
            <t:ListLevelStyle FontFamily="Courier New"
                              LevelText="o"
                              NumberingFormat="Bullet"
                              StartingIndex="1" />
            <t:ListLevelStyle FontFamily="Wingdings"
                              LevelText=""
                              NumberingFormat="Bullet"
                              StartingIndex="1" />
            <t:ListLevelStyle FontFamily="Symbol"
                              LevelText=""
                              NumberingFormat="Bullet"
                              StartingIndex="1" />
            <t:ListLevelStyle FontFamily="Courier New"
                              LevelText="o"
                              NumberingFormat="Bullet"
                              StartingIndex="1" />
            <t:ListLevelStyle FontFamily="Wingdings"
                              LevelText=""
                              NumberingFormat="Bullet"
                              StartingIndex="1" />
            <t:ListLevelStyle FontFamily="Symbol"
                              LevelText=""
                              NumberingFormat="Bullet"
                              StartingIndex="1" />
            <t:ListLevelStyle FontFamily="Courier New"
                              LevelText="o"
                              NumberingFormat="Bullet"
                              StartingIndex="1" />
            <t:ListLevelStyle FontFamily="Wingdings"
                              LevelText=""
                              NumberingFormat="Bullet"
                              StartingIndex="1" />
        </t:ListStyle>
    </t:RadDocument.ListStyles>
    <t:Section>
        <t:Paragraph FontSize="13">
            <t:Span FontFamily="Calibri"
                    FontSize="13"
                    FontWeight="Bold"
                    Text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. Praesent condimentum, mi a blandit mattis, ligula nisl gravida quam, et mattis augue purus id elit. Cras commodo, lorem vel iaculis aliquet,"
                    UnderlineColor="#FF000000"
                    UnderlineDecoration="None" />
        </t:Paragraph>
        <t:Paragraph FontSize="13"
                     SpacingAfter="0" />
        <t:Paragraph FontSize="13"
                     SpacingAfter="0">
            <t:Span FontFamily="Calibri"
                    FontSize="13"
                    Text="tellus sem pellentesque est, non tempus metus turpis quis velit. Aliquam facilisis, urna tempor eleifend egestas, tortor orci congue est, sit amet tincidunt tortor mi nec est. "
                    UnderlineColor="#FF000000"
                    UnderlineDecoration="None" />
        </t:Paragraph>
        <t:Paragraph FontSize="13"
                     SpacingAfter="0" />
        <t:Paragraph FontSize="13"
                     SpacingAfter="0">
            <t:Paragraph.ListItemSerializationData>
                <t:ListItemSerializationData ListID="1"
                                             ListLevel="0" />
            </t:Paragraph.ListItemSerializationData>
            <t:Span FontFamily="Calibri"
                    FontSize="13"
                    Text="Praesent"
                    UnderlineColor="#FF000000"
                    UnderlineDecoration="None" />
        </t:Paragraph>
        <t:Paragraph FontSize="13"
                     SpacingAfter="0">
            <t:Paragraph.ListItemSerializationData>
                <t:ListItemSerializationData ListID="1"
                                             ListLevel="0" />
            </t:Paragraph.ListItemSerializationData>
            <t:Span FontFamily="Calibri"
                    FontSize="13"
                    Text="id arcu vitae "
                    UnderlineColor="#FF000000"
                    UnderlineDecoration="None" />
        </t:Paragraph>
        <t:Paragraph FontSize="13"
                     SpacingAfter="0">
            <t:Paragraph.ListItemSerializationData>
                <t:ListItemSerializationData ListID="1"
                                             ListLevel="0" />
            </t:Paragraph.ListItemSerializationData>
            <t:Span FontFamily="Calibri"
                    FontSize="13"
                    Text="quam scelerisque varius. "
                    UnderlineColor="#FF000000"
                    UnderlineDecoration="None" />
        </t:Paragraph>
    </t:Section>
</t:RadDocument>

3 Answers, 1 is accepted

Sort by
0
Ivailo Karamanolev
Telerik team
answered on 01 Jul 2011, 02:46 PM
Hello Hwsoderlund,

The reason you are seeing these symbols is that you are using a font that doesn't support the Unicode bullet symbol (http://www.fileformat.info/info/unicode/char/2022/index.htm). All format providers utilize UTF-8 in order to support Unicode and avoid problems with special characters. Any further encoding conversion must be done with care to preserve these special characters. If you are converting them to ASCII or something similar, you must make sure to convert these characters to something supported (e.g. '*').
We are using the same default bullets as Microsoft Word does, so if you want to convert them to '*', you can simply use string.Replace on the output.
Let us know if you need further assistance.

Regards,
Ivailo
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
hwsoderlund
Top achievements
Rank 1
answered on 04 Jul 2011, 09:46 AM
I am not sure I understand what I need to do about the font settings to avoid this. I have tried replacing the characters with "*" manually, and that works. But I would still like to understand what I was doing wrong in the first place. I have posted an example project with instructions embedded. In that project I am using the default fonts provided by Silverlight, no custom settings at all. Please take a look at the code and let me know what needs to be changed.

Example project on dropbox:
http://db.tt/NRl9Rei

Thank you,
/Henrik
0
Accepted
Ivailo Karamanolev
Telerik team
answered on 04 Jul 2011, 03:45 PM
Hello Henrik,

Indeed, some of the default list bullets are not visible in the Silverlight fonts. We have chosen the symbols to be the same as those used by Word, which uses the Symbol font to show the level 1 symbol and Wingdings for level 3. Therefore, these special characters are visible with these fonts and do not appear properly when exported to plain text.
You can refer to this blogpost about creating and using custom lists, so that you can prevent this behavior by choosing symbols in Silverlight fonts. Processing the exported document is the other option to handle this issue.
If you have other questions, do not hesitate to contact us again.

All the best,
Ivailo
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
RichTextBox
Asked by
hwsoderlund
Top achievements
Rank 1
Answers by
Ivailo Karamanolev
Telerik team
hwsoderlund
Top achievements
Rank 1
Share this question
or