richtext rtf

Posted by: kisar on 1 April 2020, 6:04 am EST

  • Posted 1 April 2020, 6:04 am EST

    Hi, im using richtext component loading and saving rtf,
    1. load to richtext > this.c1richTextBox.Document = new C1.WPF.RichTextBox.Documents.RtfFilter().ConvertToDocument(rtf_string)
    2. save from richtext > rtf_string =new C1.WPF.RichTextBox.Documents.RtfFilter().ConvertFromDocument(this.c1richTextBox.Document)

    I have this problem, every time i load rtf string into richtextbox, i find a wrong distance between the lines, specifically if i select the text and i go manually into the paragraph > margin > bottom i find it always different than zero,
    so i set to zero and i see the correct distance, i save, when i load again i have the same issue.
    I'm also sure about the rtf saved because if i load it with a different richtextbox it appear correctly

    Any suggestion?
  • Replied 2 April 2020, 1:10 am EST

    Hi,

    Can you please share the rtf string you are passing to C1RichTextBox and also, share the ComponentOne version you are currently using. This will help conduct a proper investigation for the issue you mentioned.

    Regards,
    Ruchir
  • Replied 2 April 2020, 4:32 am EST

    Hi,
    my version is : wpf__4.0.20192.658
    this is the very simple example that would have to show :
    CONT.
    Taxable Amount : 1,000.00+vat
    Thanx

    Rtf:
    {\rtf1\ansi\ansicpg1252\deff0\deflang1033\deflangfe1033
    {\fonttbl
    {\f0\fcharset0 Verdana;}
    }
    {\colortbl
    \red0\green0\blue0;
    }
    {\pard
    \f0\sa150
    \fs14
    \par}
    {\pard
    \f0
    \fs14
    CONT.\par}
    {\pard
    \f0
    \fs14
    Taxable Amount : 1,000.00+vat\par}
    {\pard
    \f0\sa150
    \fs14
    \par}
    }
  • Replied 3 April 2020, 10:52 pm EST

    Hello,

    Thank you for sharing the string. Testing it, I too see the behavior and it looks like the control is replacing the vertical spacing between the paragraph lines with the default paragraph margin. So, I have reported it to the concerned team for fix [ID:430015] and will let you know, once it gets fixed or we receive some information.

    ~Regards,
  • Marked as Answer

    Replied 5 August 2020, 3:03 am EST

    Hello,

    I am happy to let you know that the issue you reported is fixed in the latest release version. To upgrade to the latest version, please use ComponentOneControlPanel utility and follow the below steps:
    1. Enter login details or select 'Proceed as anonymous user'.
    2. Select the 'Build Repository' option in the tool strip menu at top.
    3. Check the 'Include prerelease and hotfix versions' checkbox.
    4. Expand the 'WPF Edition' and click the 'Update' button corresponding to 'Control Library for WPF(.NET 4.5.2)'.
    5. Also, since you're using Report, please click the 'Update' Button corresponding to 'Reports for WPF'.

    Also, should you wish to upgrade the assemblies manually, please download the assemblies from here:
    http://prerelease.componentone.com/dotnet452/c1wpflibrary/2020-t2/C1WPFBasicLibrary.4.5.2_4.5.20202.716.zip
    http://prerelease.componentone.com/dotnet40/c1wpflibrary/2020-t2/C1WPFBasicLibrary.4_4.0.20202.716.zip

    Additionally, please note that there are 2 paragraphs in the sample rtf and in each of paragraph we have 10 px bottom margin. That's incorrect way to use line-height / line spacing / sl;slmult (rtf)
    1. Please add all the line in same paragraph block (example: long content inside a <p> tag in html, or long content in many lines in par keyword in rtf).
    2. Don't forget to add line-height (HTML) or sl;smult (RTF), or just normally switch to document tab use line-spacing in toolbar.
    We have implemented these with correct line spacing usage in the added C# file. Please use it to observe the fixed issue.
    For further information, you can lookup in rtf standard document / html line spacing:
    http://www.biblioscape.com/rtf15_spec.htm#Heading31
    https://www.w3.org/TR/CSS2/visudet.html#propdef-line-height
    Download URL: https://www.dropbox.com/s/cszl14k7gwcwos7/RichTextBoxSamples.zip?dl=0

    Regards,
    Ruchir
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels