Losing Margin after HTML import

2 posts, 0 answers
  1. Paul
    Paul avatar
    4 posts
    Member since:
    Oct 2012

    Posted 07 Jan 2013 Link to this post

    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);            
            }
         

  2. Plamen
    Admin
    Plamen avatar
    132 posts

    Posted 10 Jan 2013 Link to this post

    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.
  3. UI for WinForms is Visual Studio 2017 Ready
Back to Top