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

Repeated Import/Export Changes Spacing

1 Answer 53 Views
RichTextBox
This is a migrated thread and some comments may be shown as answers.
Jeff
Top achievements
Rank 1
Jeff asked on 26 Jan 2011, 12:51 AM
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 = 
DocumentExportLevel.Fragment,
    StylesExportMode = 
StylesExportMode.Inline
};
ret = exporter.Export(radDocument);
ret = ret.Trim();
return ret;

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

Any help?

 

 

 

 

 

 

1 Answer, 1 is accepted

Sort by
0
Iva Toteva
Telerik team
answered on 28 Jan 2011, 02:03 PM
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;
    dictionary.Load(stream);
    ((DocumentSpellChecker)this.editor.SpellChecker).AddDictionary(dictionary, CultureInfo.InvariantCulture);
}

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

Regards,
Iva
the Telerik team
Let us know about your Windows Phone 7 application built with RadControls and we will help you promote it. Learn more>>
Tags
RichTextBox
Asked by
Jeff
Top achievements
Rank 1
Answers by
Iva Toteva
Telerik team
Share this question
or