Setting TfrxReport.PrintOptions.PrintOnSheet In Code

edited August 2017 in FastReport VCL 5
I'm trying to print a report multiple times on a single page. If I set TfrxReport.PrintOptions.ShowDialog = true and pick the sheet I need to use (Letter) from the dialog everything works as expected.

However, I need to bypass the dialog, set the sheet in code and just print the report.

How do you set TfrxReport.PrintOptions.PrintOnSheet in code?

Any suggestions?

Comments

  • gpigpi
    edited 4:04AM
    Try frxReport1.PrintOptions.PrintOnSheet := 1;
  • edited 4:04AM
    gpi wrote: »
    Try frxReport1.PrintOptions.PrintOnSheet := 1;

    Thank you so much. That worked perfectly.

    Is there a reference for what values to use with PrintOnSheet?
  • gpigpi
    edited 4:04AM
      PaperInfo: array[0..PAPERCOUNT - 1] of TPaperInfo = (
        (Typ:1;  Name: ''; X:2159; Y:2794),
        (Typ:2;  Name: ''; X:2159; Y:2794),
        (Typ:3;  Name: ''; X:2794; Y:4318),
        (Typ:4;  Name: ''; X:4318; Y:2794),
        (Typ:5;  Name: ''; X:2159; Y:3556),
        (Typ:6;  Name: ''; X:1397; Y:2159),
        (Typ:7;  Name: ''; X:1842; Y:2667),
        (Typ:8;  Name: ''; X:2970; Y:4200),
        (Typ:9;  Name: ''; X:2100; Y:2970),
        (Typ:10; Name: ''; X:2100; Y:2970),
        (Typ:11; Name: ''; X:1480; Y:2100),
        (Typ:12; Name: ''; X:2500; Y:3540),
        (Typ:13; Name: ''; X:1820; Y:2570),
        (Typ:14; Name: ''; X:2159; Y:3302),
        (Typ:15; Name: ''; X:2150; Y:2750),
        (Typ:16; Name: ''; X:2540; Y:3556),
        (Typ:17; Name: ''; X:2794; Y:4318),
        (Typ:18; Name: ''; X:2159; Y:2794),
        (Typ:19; Name: ''; X:984;  Y:2254),
        (Typ:20; Name: ''; X:1048; Y:2413),
        (Typ:21; Name: ''; X:1143; Y:2635),
        (Typ:22; Name: ''; X:1207; Y:2794),
        (Typ:23; Name: ''; X:1270; Y:2921),
        (Typ:24; Name: ''; X:4318; Y:5588),
        (Typ:25; Name: ''; X:5588; Y:8636),
        (Typ:26; Name: ''; X:8636; Y:11176),
        (Typ:27; Name: ''; X:1100; Y:2200),
        (Typ:28; Name: ''; X:1620; Y:2290),
        (Typ:29; Name: ''; X:3240; Y:4580),
        (Typ:30; Name: ''; X:2290; Y:3240),
        (Typ:31; Name: ''; X:1140; Y:1620),
        (Typ:32; Name: ''; X:1140; Y:2290),
        (Typ:33; Name: ''; X:2500; Y:3530),
        (Typ:34; Name: ''; X:1760; Y:2500),
        (Typ:35; Name: ''; X:1760; Y:1250),
        (Typ:36; Name: ''; X:1100; Y:2300),
        (Typ:37; Name: ''; X:984;  Y:1905),
        (Typ:38; Name: ''; X:920;  Y:1651),
        (Typ:39; Name: ''; X:3778; Y:2794),
        (Typ:40; Name: ''; X:2159; Y:3048),
        (Typ:41; Name: ''; X:2159; Y:3302),
        (Typ:42; Name: ''; X:2500; Y:3530),
        (Typ:43; Name: ''; X:1000; Y:1480),
        (Typ:44; Name: ''; X:2286; Y:2794),
        (Typ:45; Name: ''; X:2540; Y:2794),
        (Typ:46; Name: ''; X:3810; Y:2794),
        (Typ:47; Name: ''; X:2200; Y:2200),
        (Typ:50; Name: ''; X:2355; Y:3048),
        (Typ:51; Name: ''; X:2355; Y:3810),
        (Typ:52; Name: ''; X:2969; Y:4572),
        (Typ:53; Name: ''; X:2354; Y:3223),
        (Typ:54; Name: ''; X:2101; Y:2794),
        (Typ:55; Name: ''; X:2100; Y:2970),
        (Typ:56; Name: ''; X:2355; Y:3048),
        (Typ:57; Name: ''; X:2270; Y:3560),
        (Typ:58; Name: ''; X:3050; Y:4870),
        (Typ:59; Name: ''; X:2159; Y:3223),
        (Typ:60; Name: ''; X:2100; Y:3300),
        (Typ:61; Name: ''; X:1480; Y:2100),
        (Typ:62; Name: ''; X:1820; Y:2570),
        (Typ:63; Name: ''; X:3220; Y:4450),
        (Typ:64; Name: ''; X:1740; Y:2350),
        (Typ:65; Name: ''; X:2010; Y:2760),
        (Typ:66; Name: ''; X:4200; Y:5940),
        (Typ:67; Name: ''; X:2970; Y:4200),
        (Typ:68; Name: ''; X:3220; Y:4450));
    
  • edited 4:04AM
    gpi wrote: »
      PaperInfo: array[0..PAPERCOUNT - 1] of TPaperInfo = (
    

    Thanks again. Found the source file - frxLazPrinters.inc for anyone looking at this thread. The pages are defined in increments of 0.1 mm. The Letter (or 8.5" x 11") is 2159 x 2794 or 215.9 mm x 279.4 mm which converts to 8.5" x 11".

    Here's a helpful resource on paper sizes: http://www.papersizes.org/
  • edited 4:04AM
    gpi wrote: »
    [code] PaperInfo: array[0..PAPERCOUNT - 1] of TPaperInfo = (

    Using 0 seems to set PrintOnSheet to the PaperSize, PaperHeight and PaperWidth property from the report. The values of TPaperInfo[0] might be the default values for a new report but they are not necessarily what's used if you set PrintOnSheet to 0 - correct?

    If PrintOnSheet is set to 4 for Legal size paper and that paper is not available at the printer, PrintOnSheet is automatically set to 0 and the values of PaperSize, PaperHeight and PaperWidth are used. This is true for any paper type that is not available.

    The point is just a heads up for anyone looking at this thread, setting PrintOnSheet to values not supported by a printer does not help you figure out if you're picking the correct indexes into TPaperInfo.

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.