or
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); }
private
void
btnRedo_Click(
object
sender, System.EventArgs e)
{
_richTextBox.Redo();
_richTextBox.Focus();
}
string text = File.ReadAllText(@"c:\temp\RichText.txt");
Byte[] convertedText = Encoding.ASCII.GetBytes(text);
RadDocument document = _htmlFormatProvider.Import(convertedText);
string text = File.ReadAllText(@"c:\temp\RichText.txt");
RadDocument document = _htmlFormatProvider.Import(text);
public Form1()
{
InitHtmlFormatProvider();
InitializeComponent();
}
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");
Byte[] convertedText = Encoding.ASCII.GetBytes(text);
RadDocument document = _htmlFormatProvider.Import(convertedText);
radRichTextBox1.Document = document;
}
private void commandBarButtonSave_Click(object sender, EventArgs e)
{
string html = _htmlFormatProvider.Export(radRichTextBox1.Document);
File.WriteAllText(@"c:\temp\RichText.txt", html);
}