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

Losing Margin after HTML import

1 Answer 108 Views
RichTextBox (obsolete as of Q3 2014 SP1)
This is a migrated thread and some comments may be shown as answers.
Paul
Top achievements
Rank 1
Paul asked on 07 Jan 2013, 05:35 PM
I am using IncrementParagraphLeftIndent() to increase the left margin. When I export using the html provider I can see the margin has been set in the Style for that run.

<style type="text/css">
.p_6F87C71A { margin: 0px 0px 0px 28px;text-align: left;text-indent: 0pt;padding: 0px 0px 0px 0px; } 
.s_6BF1D20F { font-family: 'Calibri';font-style: normal;font-size: 16px;color: #000000; } 
</style><p class="p_6F87C71A"><span class="s_6BF1D20F">This text should be indented</span></p>

However, when I import using the html provider the margin setting is lost. When I export again I can see the margin is set to 0.

<style type="text/css">
.p_384D933F { margin: 0px 0px 0px 0px;text-align: left;text-indent: 0pt;padding: 0px 0px 0px 0px; } 
.s_6BF1D20F { font-family: 'Calibri';font-style: normal;font-size: 16px;color: #000000; } 
</style><p class="p_384D933F"><span class="s_6BF1D20F">This text should be indented</span></p>

Here's the code I'm using for Import/Export:


        private static HtmlFormatProvider _htmlFormatProvider;
 
        private static void InitHtmlFormatProvider()
        {
            _htmlFormatProvider = new HtmlFormatProvider();
            var htmlExportSettings = new HtmlExportSettings();
            htmlExportSettings.DocumentExportLevel = DocumentExportLevel.Fragment;
            _htmlFormatProvider.ExportSettings = htmlExportSettings;
        }
 
        private void commandBarButtonLoad_Click(object sender, EventArgs e)
        {
            string text = File.ReadAllText(@"c:\temp\RichText.txt");
            RadDocument document = _htmlFormatProvider.Import(text);
            radRichTextBox1.Document = document;
        }
 
 
        private void commandBarButtonSave_Click(object sender, EventArgs e)
        {
            string html = _htmlFormatProvider.Export(radRichTextBox1.Document);
            File.WriteAllText(@"c:\temp\RichText.txt", html);            
        }
     

1 Answer, 1 is accepted

Sort by
0
Plamen
Telerik team
answered on 10 Jan 2013, 02:00 PM
Hello Paul,

Thank you for writing.

I managed to reproduce the issue by following the supplied information. I can confirm that RadRichTextBox does not behave correctly when exporting to HTML. I have added this as a bug report to our Public Issue Tracking System. Feel free to add your vote for it here: http://www.telerik.com/support/pits.aspx#/public/winforms/13971

Unfortunately, due to the internal implementation of the control, I am not able to provide you with a valid work around.

I have updated your Telerik Points for this report.

I hope that you find this information useful. Please excuse us for the introduced inconvenience.

Kind regards,
Plamen
the Telerik team
Q3'12 SP1 of RadControls for WinForms is out now. See what's new.
Tags
RichTextBox (obsolete as of Q3 2014 SP1)
Asked by
Paul
Top achievements
Rank 1
Answers by
Plamen
Telerik team
Share this question
or