Emitting backslashes in C++

General TRichView support forum. Please post your questions here
Post Reply
rgsolutions
Posts: 86
Joined: Mon Jun 08, 2009 11:25 pm

Emitting backslashes in C++

Post by rgsolutions »

I am trying to output an RTF file with mixed page orientations. I have been following your example and have run into a problem that I cannot solve. I use the following statement:

rv->AddNL ("\\pgwsxn12240\\pghsxn15840", 1, 0);

What I see in RichViewEdit is "\pgwsxn12240\pghsxn15840" (this has become part of the displayed text) and the output RTF file contains two backslashes in front of each parameter (exactly as the literal string). If I change the double backslash to a single backslash, the RichViewEdit display is the same only without the slashes (they are removed) and the corresponding output to the RTF file is missing all backslashes.

The question is, how do I insert text with backslashes in C++?
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Use a text style with rvteoRTFCode in Options property.
For this text, backslashes are saved in RTF as they were inserted in text.
rgsolutions
Posts: 86
Joined: Mon Jun 08, 2009 11:25 pm

Post by rgsolutions »

I got it to work thanks.

It does not appear that I can unconditionally add the RTF codes to the text when building the text. The desire would be to have one set of RichView text that can be both displayed and exported. In the display mode, the RTF codes would have to suppressed, but when exporting the RTF codes would be included. I can understand the issues associated with this.

I will write code that knows the type of output (display or RTF) so that it will know whether to add the RTF codes or not.
Sergey Tkachenko
Site Admin
Posts: 17559
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post by Sergey Tkachenko »

Currently, hidden text is not supported, so all text is visible.
There is an alternative solution to using text with RTF codes: using components + OnSaveComponentToFile event.
Example can be found here:
http://www.trichview.com/forums/viewtopic.php?t=2742
Post Reply