Re: Fluctuation of printer alignment
- From: "Mike Williams" <Mike@xxxxxxxxxxxxxxxxx>
- Date: Sat, 24 Sep 2005 21:31:09 +0100
"pitters" <pitters@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:CE7A3F5A-412E-4202-A3CC-7100E6E82EC9@xxxxxxxxxxxxxxxx
> . . . It's that I print the same report twice - first time, it's out of
> alignment, the second time it's perfect - same report, same code,
> same Tabs and CurrentX's!!! ???
First off, *don't use Tabs*! Don't use even a single Tab! Not anywhere! They
may (or may not) be the cause of your problem, but they definitely have
shown themselves to be unreliable in the past. Ditch all your Tabs and use
only CurrentX (and possibly CurrentY) to position all your text. If you
still have problems after you have done that then post again. If you do have
to post again then you'll need to post *full* details of your code (if
necessary, create a brand new VB project (preferably containing just a
single Form) and place as much of your current code into it so that it runs
and actually prints one of your reports (if necessary using dummy or perhaps
randomly generated data). Then *make sure that it exhibits the problem you
are having* and post it to the group (preferably posting the entire .frm
code rather than just the code so that we will have *exactly* the Form that
you are working with. Also post full details of the system you are using,
together with details of then printer and also any information about any
other application running on the same machine that may also use that same
printer in between the printing of your individual reports.
As I recall you said in one of your earlier posts that sometimes (on a
report that prints out faulty) a line of text that should take only a single
lines actually takes up two or three or more lines. That behavious is
typical of a Tab to an X position that is "behind" the current value of
CurrentX (in othjer woprds behind the end of the last piece of text that was
printed on that linbe). In such a case VB will print at the required Tab
position *but on the next line down*. It's difficult to say for sure without
seeing more of your code, but that "Tab makes it go to the next line down"
behaviour is quite likely at the root of your problem. GET RID OF THOSE
TABS! Then post again.
By the way, are you *sure* that the font is the same every time you print
the page. Certain combinations of printer driver, operating system and VB
service pack number did at one time have a problem with the printer object
"forgetting the font it is supposed to beusing" under certain conditions,
particular after a Printer.Newline. Also, certain combinations had a habit
of failing to comply with your request for a certain font (basically because
VB "thought" that it was already using the selected font when actually it
was not. I really did think that all of those problems had been solved by
now, but just in case they still exist on your particular setup you should
make sure that you set up the font and the font size (and also possibly the
font bold) at the start of every Print Job and *also at the start of every
new page*. Also, just in case your machine has the second problem, you
should ensure that you reinforce your selections by "toggling". What I mean
by toggl;ing is that you should set a specific property to something you *do
not* want and then follow that by a printer.Print statement (that bit is
important) and then set the same property to something that you *do* want.
You should do all thnis at the start of every print job and also at the
start of every new page in that print job (by the way, every print job
should start off with a simple Printer.Print statement). Suppose for example
that you actually want to use Times New Roman size 12, then at the start of
the print job and also at the start of every new page (after each
printer.NewPage) you should use something like:
Printer.Font.Name = "Arial"
Printer.Print
Printer.Font.Name = "Times New Roman"
Printer.Font.Size = 99
Printer.Print
Printer.Font.Size = 12
Printer.CurrentX = 0
Printer.CurrentY = 0
The above cose is a way of solving the "forgot my font" and also the "fail
to set font" problems on systems which had those problems. It is a bit of a
"belt and braces" thing now of course, because as far as I know those
problems no longer exist. However, it is worth doing them just in case they
do for some reason exist on your own system.
Anyway, Ill repeat, DITCH THOSE TABS!
If you do all these things and you are still having problems then post again
with *full details of your system and printer and everything* and also with
the full text of a VB .frm file that contains its own dummy opr randoml;y
generated data and that exhibits the problem you are having. Please postr
back anyway, even if the above stuff does happen to fix your problem, so
that we'll know what did it.
Mike
.
- Follow-Ups:
- Re: Fluctuation of printer alignment
- From: Mike Williams
- Re: Fluctuation of printer alignment
- References:
- Re: Fluctuation of printer alignment
- From: Mike Williams
- Re: Fluctuation of printer alignment
- Prev by Date: Re: Out of stack space
- Next by Date: Re: Fluctuation of printer alignment
- Previous by thread: Re: Fluctuation of printer alignment
- Next by thread: Re: Fluctuation of printer alignment
- Index(es):
Relevant Pages
|