Save RichTextBox as RTF in A4 and landscape

A

Anna

I'r like to save my RTF-file (text frommy RichTextBox) in A4 format and
landscape.
Saving as RTF-file isn't the problem, but can't find any solution to add
some information for A4 and landscape.
The intention is that when a user opens the RTF-file using Ms Word, the page
is in A4 format and in landcape.

Any suggestions ?

Anna
 
P

Peter Duniho

Anna said:

Sorry…didn't notice your question earlier. That said, it's not really a
C# or .NET question, so your ability to get useful advice here is limited.

The settings you're talking about – paper size and orientation – are
printer settings, not document attributes. Many programs do in fact
save printer settings with their document files, but AFAIK this isn't
inherent in the RTF format.

It's possible that RTF defines a way to escape arbitrary kinds of data.
In which case, depending on how you're accessing the printer settings
themselves, you may be able to store the specific data in the RTF
document. But such data would still only be specifically accessible by
your application; lacking a specification for storing that data, no
other application would understand it.

All of the above is with respect to printer settings generally (which
include far more than just the paper size and orientation). However,
looking at the RTF specification, it appears that there is support for
those two specific settings.

The "\pszN" control word allows you to define paper sizes (I don't know
the specific value you need to use for N to get A4, but you should be
able to look that up as easily as I could), and you can use "\landscape"
to change the document default to landscape, or the "\lndscpsxn" control
word to have a specific section within the document be specified as
landscape.

Keep in mind, however, that you might have to track these properties
independently of the RichTextBox control. Those properties aren't going
to be useful to the control itself, and if it does any sort of parsing
or filtering on RTF when the text for the control is set, it might just
discard those control words if it sees them.

Pete
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top