PDA

View Full Version : How to use justify feature for a Range instead of Paragraph



mahdyar
09-11-2007, 11:46 AM
You know we can use "wdAlignParagraphJustifyLow" or other wdAlignParagraph..... in code to align a paragraph. But I want to use this feature to Justify some peices of text to my custom width. How can I do it?

fumei
09-11-2007, 12:12 PM
Make the Range and use the alignment property.

mahdyar
09-11-2007, 12:21 PM
Thanks but I want to use Justify to MY CUSTOM WIDTH (in pixels).
The default feature causes to justify to ActiveWindow usable width. but I would like to use my own width.

fumei
09-11-2007, 12:36 PM
Then use a Style and assign it. It is better to use a Style anyway.

mahdyar
09-11-2007, 11:00 PM
Dear fumei,
Thank you for your replies. But I think I should explain my problem a bit more. Soppose we have four pieces of text like this:

This is sentence one

mahdyar
09-11-2007, 11:10 PM
Dear fumei,
Thank you for your replies. But I think I should explain my problem a bit more. Suppose we have four pieces of text like this:

This is sentence one [TAB] This is sentence two
This is sentence three [TAB] This is sentence four

Here the width (in pixels) of third sentence is more than others. I want to set the width of other sentences the same as the third sentence without adding any character. Range.ParagraphFormat.Alignment causes all the paragraph have the same width as the ActiveWindow.UsableWidth. But what about my problem?
If the font is a constant width one, maybe the solution is to add space, but I am using a variable width font.

TonyJollans
09-12-2007, 05:23 AM
I don't think there's any way to do that. Tabstops can control where the next text starts (as you appear to already have) but the preceding text isn't justified.

You should be able to achieve the effect by having each phrase as a separate justified paragraph in its own table cell.

mahdyar
09-14-2007, 11:45 PM
Dear Tony,
I dont know how to justify in all table cell width. Please explain more.

TonyJollans
09-15-2007, 01:43 PM
You justify a paragraph in a table cell the same way you justify any other paragraph, but ...

... justification does not happen on the last line of a paragraph no matter how it's done. You can rig it by adding a manual line break and reducing the font size on the last empty line but it's horrible.

Why do you want this very spread out text?