Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Can I change the Paper size at runtime?

Posted on 2000-04-19
4
Medium Priority
?
202 Views
Last Modified: 2010-04-04
I want to change a Qreport from A3 to A4, How can I do that at runtime?

thanks
0
Comment
Question by:kelvinyu
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 1

Accepted Solution

by:
ronvp earned 150 total points
ID: 2733591
To set the report paper size just do like this:
         
aReport.Page.PaperSize := A4
or back

aReport.Page.PaperSize := A3;

Note that when you change paper size that your controls may not always prinht correctly..

also here is a tip.. If you design reports in Landscape A4, and then change to Portrait A3, you will keep your report looking good and get more records on a page..

Switching from landscape to portrait is done like this:
 
aReport.Page.Orientation := poPortrait;

Before you switch from A4 to A3 from within your code, you may check if the printer actually supports A3 like this:

(function returns TRUE if the printer supports A3 or 11" x 17"

Function PrinterHasA3: Boolean;
var Device, Driver, Port: array[0..255] of char;
    ADevMode: THandle;
    Rslt: integer;
    i: integer;
    PN: Array of Word;
Begin
   Screen.Cursor := crHourGlass;
   Result := False;
   with Printer do
       GetPrinter(Device, Driver, Port, ADevMode);
   // Get the number of paper names
   Rslt := DeviceCapabilitiesA(Device, Port, DC_PAPERS, nil, nil);
   if Rslt > 0 then begin
     SetLength(PN, Rslt);
     try
       // Retrieve the list of names into memory
       if DeviceCapabilitiesA(Device, Port, DC_PAPERS, Pointer(PN), nil) = - 1 then
          raise Exception.Create('Device capabilites error');
       // Check the paper names
       for i := 0 to Rslt - 1 do
          If (PN[i] = DMPAPER_11X17) or (PN[i] = DMPAPER_A3) then begin
             Result := True;
             Break;
          end;
     finally
       PN := NIL;
    end;
  end;
  Screen.Cursor := crDefault;
end;

0
 

Author Comment

by:kelvinyu
ID: 2733669
ronvp:

I have tried this method before, while complie the program ,it met a error message - "Undeclared Indentifier:'A4'"
Should I use some UNITs?
0
 
LVL 1

Expert Comment

by:ronvp
ID: 2734987
Kelvinyu,

You must have QRPrntr in your uses clause..

Ron
0
 

Author Comment

by:kelvinyu
ID: 2742586
The Report Size can be changed now
Thanks you
0

Featured Post

Tech or Treat!

Submit an article about your scariest tech experience—and the solution—and you’ll be automatically entered to win one of 4 fantastic tech gadgets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question