Roy Woll
Re: Save/use page margins in RichEdit .rtf docs?
Shortcut to this article
Printer Friendly

Re: Save/use page margins in RichEdit .rtf docs?

Hi Roy,

My app already saves and retrieves the last Printmargin properties using the Registry, but this doesn't solve the problem because users want different print margins for different types of documents, and they can't be expected to remember what margins they set for which document. Further, there's no way of knowing if a user has either used another app to create a doc with margins different from my app's Printmargin settings or modified a doc's margins with another app before opening/reopening the doc with my app. These are the reasons margins need to be associated with (part of the {\rtf1...} info in) each document!
Here's my wish list:
1) I want to have each .rtf document's Printmargins properties automatically saved with the document, i.e., in the {\rtf1...}"header" info the way Word does using \margl..., \margr..., \margt..., and \margb....
2) When a document is opened, I want the \marg... info (if any) in the document to be used to set the Rich Edit's Printmargins properties automatically. If no \marg... info exists in the header, then the Rich Edit's current Printmargin properties should be used.
3) Tall order: It would be very helpful to users if there were a way to show where page breaks occur (like Word does). Right now, the user has to print the doc to see how the margin-dependent pagination will come out. IMHO, this is a severe (and annoying) limitation.
4) My compromise for #3 is going to be to add a print preview capability to my app's Rich Edit functionality. Hint, hint. <g>
Since IP's Rich Edit doesn't save and retrieve each .rtf doc's Printmargin properties automatically, I'm going to have to go through interim steps (hidden from the user) of getting the doc in plain text form to save and retrieve margin info. For example:
if Open New doc then    set Printmargin properties from my app's Registry keys else if Open Existing doc then begin    get doc in plain text format (hidden from user);    scan the doc's {\rtf1...} info to see if \marg... info exists;    if \marg... info is found then       set Printmargins properties using the \marg... info    else       set Printmargin properties from app's Registry keys;    display doc to user in rich text format; end; if Save as rich text format then begin    put the doc in plain text format (hidden from user);    if {\marg...} info does not exist in header then       insert {\marg...} info using Printmargin properties    else       modify {\marg...} info using Printmargin properties;    save the doc in rich text format; end;
So far I've found that if I use Notepad to insert a {\margl...\margr...\margt...\margb...} clause in the header of an rtf doc that was created with IP's Rich Edit, Word will ignore the margin info if I don't do it according to how Word is expecting it. I haven't yet figured out what I need to do to make Word accept \marg... info I've inserted this way. (I don't have the .rtf syntax rules.)
If you have any suggestions for how I can accomplish what I want, I'll be glad to hear them! Otherwise, I'll continue slogging ahead on my own--unless you tell me you're going to implement my wish list fairly soon. Then I'd have to upgrade from IP4! <g>
Best regards,
Jack Stiles SwiftTech Software

Roy Woll <✉> wrote in message
> It seems to me, that all you need to do is to save the printmargins property
> yourself to a corresponding file (ini file).  Then you can read in the last
> saved margins and set the richedit's properties.   It would not seem
> appropriate to me to have our control generate this ini file for you as it
> assumes an implementation beyond the rtf file format.  If I am
> misunderstanding your suggestion, please clarify.
> Roy (Woll2Woll Software)
> Sales: In U.S. - 1-800-9652965,
>        Intl - 925-371-1663
> Fax:   925-371-1664
> Sales: ✉
> Home Page:
> Jack Stiles <✉> wrote in message
> news:8clhe4$bq30@Woll2WollWeb.Woll2WollWeb...
> > Hi Paul,
> >
> > As I indicated in my posting, I'm aware of the "printmargins property that
> > allows you to set the left, top, right, and bottom margins in inches." The
> > problem is that a user may change the margins of an RTF document via File,
> > Page Setup, for example, and save the document with different margins (and
> > different pagination that results from the difference in margins). Later,
> > when the user retrieves the document, unless the margin info is embedded
> and
> > used when RichEdit displays the RTF document, the margins (and pagination)
> > will revert to the RichEdit's printmargins property settings, which may
> not
> > be what the user used when the document was saved! From the user's
> > perspective, the document's margins and pagination will have been screwed
> > up!
> >
> > <Soapbox>
> > IMHO, automatically embedding and then retrieving and using a user's ..RTF
> > margin settings (or providing an easy way to do it programmatically at
> > run-time) is such a fundamental requirement that a way to do it ought to
> be
> > seriously considered as a future enhancement to InfoPower. In the
> meantime,
> > the lack of this capability seriously diminishes TwwRichEdit's utility
> > (unless I roll my own way of doing it programmatically).
> >
> > Here's another suggestion for a RichEdit enhancement: Provide a way to
> show
> > the user where the page breaks are.
> >
> > Thanks for listening.
> > </Soapbox>
> >
> > Jack Stiles
> > SwiftTech Software
> >
> > Paul <✉> wrote in message
> > news:8clajp$bq25@Woll2WollWeb.Woll2WollWeb...
> > > InfoPower 2000 supports most of the Richedit Version 2 implementation.
> I
> > > don't believe the RichEdit Version 2 supports embedded margins as you
> > > describe.
> > >
> > > However, the richedit control itself has a printmargins property that
> > allows
> > > you to set the left,top,right, and bottom margins in inches.
> > >
> > > -Paul
> > >
> > >
> >
> >
FYI: Phrase searches are enclosed in either single or double quotes
Originally created by
Sun, 14 Feb 2016 12:29:09 GMT
Copyright © 2009-2016
HREF Tools Corp.