RTF: Right-justify part of paragraph (not entire paragraph)?

L

L.Allan

I'm trying to right-justify part of a line that I'm generating with a C++
program. I'm familiar with the the \qr and \qc and \ql to justify right,
center, and left respectively.

If I embed a \qr within a paragraph, then the entire paragraph is right
justified. I want to have just the text after the \qr be right justified on
the same line, and the text before the \qr remain left justified on the same
line.

This is the equivalent of what I want to generate (first part is standard,
simple rtf header):

{\rtf1\ansi\ansicpg1252\deff0\deflang1...
{\*\generator Msftedit 5.41.15.1507;}\viewkind4\uc1\pard\nowidc...
Line 1 with standard left justification (slj)\par
Line 2 with slj and then \qr right justified\par
Line 3 with slj\ql\par
Line 4 with standard left justification (slj)\par
Line 5 with slj and then \line\qr right justified\par
Line 6 with left justification\ql\par
Line 7 with left justification
}

You can copy/paste into WordPad to see how the above is "rendered".

I can use \line\qr tags in the 5th line to cause a line-break and then the
rest of the paragraph is right-justified. I want to be able to do this
without the \line tag and have it remain as one line. I want it to look
something like:

Line 1 with standard left justification (slj)
Line 2 with slj and then.......................right justified
Line 3 with slj\ql
Line 4 with standard left justification (slj)
Line 5 with slj and then
..........................................................right justified
Line 6 with left justification
Line 7 with left justification

(above may not have intended alignment because of variable width font.

Thanks
 
T

Terry Farrell

You need to use a right-aligned tab on the paragraphs when you are trying to
'shuffle right'. Or if you really want the dot leaders (rather than it just
being for clarity in this plain text post), you need to use a right aligned
tab leader.
 
L

L.Allan

Thanks for the reply ... I hadn't heard of "right aligned tabs", but looked
at the RTF 1.5 spec and found \tqr.

I'm fuzzy on how to use this. Also, the size of CRichEdit control (using
MFC) is variable because the end-user can drag the size to be narrower. I'm
wondering is this would influence how to specify the \tqr value(s).

In the original question, I had a very simple "header", but there are
actually indentations, "out-dentations", and left aligned tabs specified.
The actual header looks like this:
{\rtf1\ansi\ansicpg1252\deff0\deflang1...
{\*\generator Msftedit 5.41.15.1507;}
\viewkind4\uc1\pard\fi-450\li450\tx450\tx700\tx950\nowidctlpar\fs36

It would be Very Helpful to see the revised rtf (Line 1 thru Line 7) to
accomplish your answer.
 
T

Terry Farrell

It would be best to post this in one of the VBA groups where the programmers
hang out. It is beyond my expertise!

Terry
 
L

L.Allan

Thanks for your assistance ...

Actually, my impression is that it isn't so much a programming question as
"What should the rtf file look like?"

I'm been doing lots of "trial and error" to get a rtf file to look ok with
WordPad, and then figure out how to generate it. I use a text editor (such
as NotePad) to "fuss with" the rtf, then save and open with WordPad, and see
what it looks like.
 

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