Profile Picture

How to add String with RTF to RichtextView

Posted By Bart Spel 6 Months Ago
Author
Message
Bart Spel
Question Posted 6 Months Ago
View Quick Profile
Forum Newbie

Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)Forum Newbie (0 reputation)

Group: Forum Members
Last Active: 6 Months Ago
Posts: 1, Visits: 1
Hi,

i am new to Nevron and i am looking for a way load a string with a complete RTF document in to the RichTextView Control.
I looked for a code sample but cannot find an example.




Nevron Support Team
Posted 6 Months Ago
View Quick Profile
Supreme Being

Supreme Being (3,273 reputation)Supreme Being (3,273 reputation)Supreme Being (3,273 reputation)Supreme Being (3,273 reputation)Supreme Being (3,273 reputation)Supreme Being (3,273 reputation)Supreme Being (3,273 reputation)Supreme Being (3,273 reputation)Supreme Being (3,273 reputation)

Group: Moderators
Last Active: 3 days ago @ 8:33 AM
Posts: 2,593, Visits: 2,279
Hi Bart,
The control supports loading from arbitrary stream (file, in memory etc.) so you simply need to convert the string to a stream - for example:

string someRichText = @"{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1033{\fonttbl{\f0\fnil\fcharset0 Calibri;}}{\colortbl;\red255\green0\blue0; }{\*\generator Riched20 10.0.14393}\viewkind4\uc1\pard\sa200\sl276\slmult1\f0\fs22\lang9 Rich \cf1 Text\cf0\par}";
byte[] bytes = ASCIIEncoding.Default.GetBytes(someRichText);
MemoryStream memoryStream = new MemoryStream(bytes);
nRichTextViewControl1.Widget.LoadFromStream(memoryStream, new Nevron.Nov.Text.Formats.NRtfTextFormat());
Hope this helps - let us know if you meet any problems or have any questions.


Best Regards,
Nevron Support Team





Similar Topics


Reading This Topic