WPCubed Product Support

Right align text

Hello all,

I have tried to use the following code to leftalign "some text" and rightalign "page 1 of 1" with tabstops - but the pagenumbering won't align to the right - what am I doing wrong?
Do you have any codesamples of the right way to do it?

vWp := TWPRichText.CreateDynamic;
  try
    vWp.WorkOnText := wpIsHeader;
    vWp.CurrAttr.ClearAllTabs;
    vwp.CurrAttr.AddTab(vWp.Header.PageWidth - vWp.Header.RightMargin, tkRight);
    vWp.InputString('Some text');
    vWp.InputString(#9);
    vWp.InputString('Page ');
    vWp.InputTextField(wpoPageNumber);
    vWp.InputString(' of ');
    vWp.InputTextField(wpoNumPages);
    vWp.InputString(CRLF);
    vWp.Refresh;
    vWp.ReformatAll;

    vWp.WorkOnText := wpIsBody;
    vWp.Print;
  finally
    FreeAndNil(vWp);
  end;

Thanks in advance
Michael Eriksen

#1 ♥ 0
7k Views 2 users read 2 min
support

You need to also subtract vWp.Header.LeftMargin

Further more, vWp.InputString(CRLF) is probably not required.
If you need a second paragraph use vWp.InputString(#13)

#2 ♥ 0

Hello again,
I have now tried your solution - but I can't get it to work. It seems that the default tabstops are used instead of my user defined tabstops.
Do you have any solutions?
Regards Michael

#3 ♥ 0
support

Which version is this - it works fine in my tests.

#4 ♥ 0

I'm using wptools version 7

Thanks in advance for any suggestion.

Michael

#5 ♥ 0
support

The latest build of WPTools 7 is 7.33 - it was posted yesterday. I recommend to download the most recent build.

#6 ♥ 0
This category is archived. No new posts are possible.