rtf

Extracting images from RichTextBox

淺唱寂寞╮ 提交于 2019-12-01 09:16:43
问题 I have an application where users may insert images into a RichTextBox. I'd like to be able to replace all the images in the RTF with some token and store the images in separate files. I'll inject the images back into the RTF later. I've managed to get the insertion working but ended up resorting to pasting them via the Clipboard (very like Insert an image into RTF document in C#). The trouble now is how to extract the images. How do I programatically select an image in a RichTextBox? Do I

RichTextBox does not display all data when I override CreateParams

半世苍凉 提交于 2019-12-01 06:42:05
问题 I found some old code written by NoBugz (Hans Passant) which, if I understand, forces the richtextbox to use RTF 5.0 instead of 4.0. Basically it's just a class which inherits RichTextBox and overrides the CreateParams property as such private static IntPtr moduleHandle; [DllImport("kernel32.dll", CharSet = CharSet.Auto)] static extern IntPtr LoadLibrary(string lpFileName); protected override CreateParams CreateParams { get { if (moduleHandle == IntPtr.Zero) { moduleHandle = LoadLibrary(

Better Way of Manipulating RichText in C#?

眉间皱痕 提交于 2019-12-01 05:44:45
I need to create and copy to the clipboard some RichText with standard "formatting" like bold/italics, indents and the like. The way I'm doing it now seems kind of inelegant... I'm creating a RichTextBox item and applying my formatting through that like so: RichTextBox rtb = new RichTextBox(); Font boldfont = new Font("Times New Roman", 10, FontStyle.Bold); rtb.Text = "sometext"; rtb.SelectAll() rtb.SelectionFont = boldfont; rtb.SelectionIndent = 12; There has got to be a better way, but after a few hours of searching I was unable to come up with anything better. Any ideas? Edit: The

HTML to RTF Converter for .NET

本秂侑毒 提交于 2019-12-01 05:21:39
I've already seen lots of posts on the site for RTF to HTML and some other posts talking about some HTML to RTF converters, but I'm really trying to get a full breakdown of what is considered the most widely used commercial product, open source product or if people recommend going home grown. Apologies if you consider this a duplicate question, but I'm trying to create a product matrix to see what is the most viable for our application. I also think this would be helpful for others. The converter would be used in an ASP.NET 2.0 application (we're upgrading to 3.5 shortly but still sticking

Add table of contents to RTF document

删除回忆录丶 提交于 2019-12-01 04:27:31
问题 I am trying to generate a RTF document by hand and eventually will do it programtically. I plan to improve pyRTF so that it can generate "Table of contents", which I think it can't. I am not able to use RTF controls words (\tc, \tcf and \tcl.) to generate a TOC. http://msdn.microsoft.com/en-us/library/aa140283(office.10).aspx gives details about TOC but I couldn't find or make any example RTF which have a TOC. So is there a simple sample showing a RTF with TOC? 回答1: I am creating a Table with

Better Way of Manipulating RichText in C#?

风格不统一 提交于 2019-12-01 03:48:28
问题 I need to create and copy to the clipboard some RichText with standard "formatting" like bold/italics, indents and the like. The way I'm doing it now seems kind of inelegant... I'm creating a RichTextBox item and applying my formatting through that like so: RichTextBox rtb = new RichTextBox(); Font boldfont = new Font("Times New Roman", 10, FontStyle.Bold); rtb.Text = "sometext"; rtb.SelectAll() rtb.SelectionFont = boldfont; rtb.SelectionIndent = 12; There has got to be a better way, but

Converting HTML markup to a RTF document

强颜欢笑 提交于 2019-11-30 23:43:22
I have an XML document containing embedded HTML content that I am attempting to convert to an RTF output file. I have the XML elements decorated with <li>, <p>, <b> and other HTML markup, that I would like to have transferred into the generated RTF. Here is what works as of now: Fetch XML tag content as string (containing HTML tags for line breaks, paragraph breaks, and lists) Write the XML tag content to an RTF file. I am using Python scripts to achieve the conversion. Also being used is ElementTree (to parse input XML) PyRTF-NG (to convert from HTML to RTF), a library that handles tables and

Setting font style for RTF document

纵饮孤独 提交于 2019-11-30 21:54:14
Having trouble setting text font style as Times New Roman for this document. I want all the test to be times new roman size 10. I generated a font table that holds the type and its the only type of my document. I want all the text to be times new roman but whenever the doc is generated it says its corrupted for some reason but if I don't set the font style the doc comes out in courier text as default and its not corrupted. {\fonttbl{\f1\froman\fprq0\fcharset0 Times New Roman;} \par Hi <#name#> \par\par Welcome to New York \par\par \b New iPad\'ae App Is Available \b0 \par These are all the

Converting HTML markup to a RTF document

北城以北 提交于 2019-11-30 18:53:25
问题 I have an XML document containing embedded HTML content that I am attempting to convert to an RTF output file. I have the XML elements decorated with <li>, <p>, <b> and other HTML markup, that I would like to have transferred into the generated RTF. Here is what works as of now: Fetch XML tag content as string (containing HTML tags for line breaks, paragraph breaks, and lists) Write the XML tag content to an RTF file. I am using Python scripts to achieve the conversion. Also being used is

RTF Bullet List Example

岁酱吖の 提交于 2019-11-30 18:28:21
It seems impossible to find a very simple working example for an RTF bullet list that looks like this: Hello World Nested (but with square as bullet please) Also nested (also square bullet) and regular again I tried to make a small sample by using Word or TextEdit.app but they produce a lot of garbage. Can anyone help out? If you looked in the Word or Wordpad formatted RTF long enough, you would find some lines that look like this: {\f2 {\pntext \'B7\tab}{*\pn\pnlvlblt\pnstart1{\pntxtb\'B7}}{\ltrch This is a test.}\li720\ri0\sa0\sb0\jclisttab\tx720\fi-360\ql\par} {\f2 {\pntext \'B7\tab}{*\pn