Repeated Import/Export Changes Spacing

2 posts, 0 answers
  1. Jeff
    Jeff avatar
    1 posts
    Member since:
    Jun 2010

    Posted 25 Jan 2011 Link to this post

    I am using the RadRichTextBox in my app and saving the results in a database in HTML format. I am using the HtmlFormatProvider for this purpose. I reload the saved results into the same app for more editing. During the reload process, the spacing between words changes. Usually, I get 2 spaces where there was one. After a second save, the anomoly levels out. But it appears that the format the provider creates the HTML string and the way the provider reads that same HTML string back in does not result in the same RadDocument format.

    As an example, I create a RadDocument with the following line:
    Normal Bold Italic Underline Normal (where Bold Italic and Underline are actually Bolded Italicized and Underlined, respectively)

    When I convert that to HTML and back to a RadDocument, it comes out like this:
    Normal  Bold  Italic  Underline Normal (the Bold Italic and Underline stay, but notice the extra spaces between each of the first four words.

    My export code looks like this:
    HtmlFormatProvider exporter = new HtmlFormatProvider();
    exporter.ExportSettings = 
    new HtmlExportSettings()
        DocumentExportLevel = 
        StylesExportMode = 
    ret = exporter.Export(radDocument);
    ret = ret.Trim();
    return ret;

    My import code looks like this:
    RadDocument ret = new RadDocument();
    importer = new HtmlFormatProvider();
    ret = importer.Import(htmlString);

    Any help?







  2. Iva Toteva
    Iva Toteva avatar
    1319 posts

    Posted 28 Jan 2011 Link to this post

    Hi Jeff,

    Thank you for getting to us about this problem. In fact, it had already been fixed and if you upgrade to the latest internal build (2010.3 1326), this issue should not be present. Let us know if you experience any issue with this or any later build.

    If you decide to use the LIB, you should know that we have found a small bug with spell checking (which has already been fixed and will be included in the next LIB). That is the default en-US dictionary is not automatically loaded and in addition to referencing the assembly, you would need the following code:

    private void editor_Loaded(object sender, RoutedEventArgs e)
        RadDictionary dictionary = new RadDictionary();
        Stream stream = Application.GetResourceStream(new Uri("Telerik.Windows.Documents.Proofing.Dictionaries.En-US;component/en-US.tdf", UriKind.Relative)).Stream;
        ((DocumentSpellChecker)this.editor.SpellChecker).AddDictionary(dictionary, CultureInfo.InvariantCulture);

    If you have any other questions, do not hesitate to contact us again.

    the Telerik team
    Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
Back to Top