genespos genespos - 1 month ago 11
Vb.net Question

Add landscape format to RichTextBox content saved as RTF

I save the content of a

RichTextBox
as
RTF
file but I need to set the page in
landscape
.

Looking for
RTF
and
Landscape
on the web I found something useful but I wasn't able to adapt to my needs:

My
RTF
file looks like this:

{\rtf1\ansi\deff0{\fonttbl{\f0\fnil\fcharset0 Courier New;}}
\viewkind4\uc1\pard\lang1040\f0\fs24\par
Amount Start End Rate Days Result\par
\'80 1.000,00 04/11/2015 31/12/2015 0,50% 58 \'80 0,79\par
\'80 1.000,00 01/01/2016 03/11/2016 0,20% 308 \'80 1,69\par
\par
Total \'80 2,48\par
}


And I found the following
RTF
example with
landscape
format:

{\rtf1\ansi\deff0 {\fonttbl {\f0 Courier;}}
{\colortbl;\red0\green0\blue0;\red255\green0\blue0;}
\landscape
\paperw15840\paperh12240\margl720\margr720\margt720\margb720
\tx720\tx1440\tx2880\tx5760
This line is the default color\line
\tab this line has 1 tab\line
\tab\tab this line has 2 tabs\line
\tab\tab\tab this line has 3 tabs\line
\tab\tab\tab\tab this line has 4 tabs\line
\cf2
\tab This line is red and has a tab before it\line
\cf1
\page This line is the default color and the first line on page 2
}


I've tried to add
\landscape
to my output string in many different locations but still not able to make it works.

Answer

Adding \landscape by itself isn't enough, you also need to set the paper width and height to be landscape:

\landscape\paperw15840\paperh12240