NWP, PRINTER.SYS, Decimal Align

Discussion about printing issues and techniques.

Moderators: Susan Smith, admin, Gabriel

Post Reply
Susan Smith
Posts: 717
Joined: Sun Aug 10, 2008 4:24 am
Location: Southern California

NWP, PRINTER.SYS, Decimal Align

Post by Susan Smith »

Hi again,

Can someone show me how to do decimal alignment in NWP using proportional fonts? I have to print 3 dollar amounts, aligned on top of each other. My print statements looks like this:

Code: Select all

print #prtfile: "[POSITION(3.00,2.5)]"&cnvrt$("pic($$$$$$$.##)",amt_one)
print #prtfile: "[POSITION(3.00,2.67)]"&cnvrt$("pic($$$$$$$.##)",amt_two)
print #prtfile: "[POSITION(3.00,2.84)]"&cnvrt$("pic($$$$$$$.##)",amt_three)
It does not align the numbers up correctly. If I have to, I can use a non-proportional font for this. I looked in the wiki, but didn't see anything under NWP or PRINTER.SYS.

Thank you!

-- Susan
gtisdale
Posts: 218
Joined: Sun Jun 07, 2009 7:54 am
Location: Concord, Massachusetts
Contact:

Post by gtisdale »

You need to use the RIGHT align in NWP. You will find life a lot easier if you use the FNPRINTNWP$ functionin FNSNAP. You are familiar with the FNPRINTBOX function for PCL. FNPRINTNWP$ is almost identical except it does not print the "text" as FNPRINTBOX does, but returns the formatted text ready for you to insert into a document.

For it to work you must declare

PRINT #XXX:"[boxverticals]" before using so BR knows to align the text on "BARS" that FNPRINT NWP inserts into the document at the points that you specify.

To align a column of figures you will want to "RIGHT" align them as follows:

PRINT #XXX:fnprintnwp$(v,h,"R",cnvrt$(mask$,number),font$)

v=vertical position in inches
h=horizontal position of the anchor point in inches
anchor point is the left side for "L" , the right side of the column for "R" and the centerpoint for "C"
"R" indicates Right, "L" would be Left and "C" for Center
The test string is a text string so I use a CNVRT$ to change a number into a formatted string
FONT$ is optional, but can be used to specify the font and size of font that should be used to print the text.

If you need to draw boxes arount you text then simply use a few FNPRINTBOX or FNDRAWBOX function along with FNPRINTNWP$.

FNGeorge
gordon
Posts: 358
Joined: Fri Apr 24, 2009 6:02 pm

Post by gordon »

Since you are using 4.2, try adding &CHR$(6) to each line:

Code: Select all

print #prtfile: "[POSITION(3.00,2.5)]"&cnvrt$("pic($$$$$$$.##)",amt_one)&CHR$(6)
print #prtfile: "[POSITION(3.00,2.67)]"&cnvrt$("pic($$$$$$$.##)",amt_two)&CHR$(6)
print #prtfile: "[POSITION(3.00,2.84)]"&cnvrt$("pic($$$$$$$.##)",amt_three)&CHR$(6)
Susan Smith
Posts: 717
Joined: Sun Aug 10, 2008 4:24 am
Location: Southern California

Post by Susan Smith »

Gordon,

What is CHR$(6) supposed to do in BR 4.2? I tried it, but it just prints a little box to the right of the data (which is still not right aligned). I don't see any reference to this in the release notes. I DO however see this section:

Code: Select all

 New NWP Cursor Positioning Mode

\Emove_cursor - this is the old mode with nothing changed


\Estop_cursor - new mode where the cursor does not move horizontally except when tabbing

    * Center uses the current position as the center
    * Right justify uses the current position as the right endpoint
    * The cursor does not move when printing text
    * Newline positioning is honored, but carriage return positioning is ignored.
    * Tab positioning is honored 
Can you explain a little further how someone would use \Estop_cursor to do right justifying - if that in fact is what it means?

-- Susan

P.S. If I can't get this going easily, I'll move on to FNPRINTNWP$. I'd like to understand the underlying NWP technology though.
gordon
Posts: 358
Joined: Fri Apr 24, 2009 6:02 pm

Post by gordon »

Better to use George's function for now.

I will post a more comprehensive writeup on this along with examples in the next week or so.
Post Reply