Reports for WinForms | ComponentOne
In This Topic
    Specifying Custom Paper Size
    In This Topic

    By default, C1Report creates reports using the default paper size on the default printer.

    You can specify the paper size and orientation using the PaperSize and Orientation properties. However, C1Report checks that the selected paper size is available on the current printer before rendering, and changes to the default paper size if the selected setting is not available.

    If you want to specify a certain paper size and use it regardless of the printers available, set the PaperSize property to Custom, and set the CustomWidth and CustomHeight properties to the page dimensions (in twips).

    To specify a custom paper size of 25" x 11" for your report using the C1ReportDesigner:

    1. Open the C1ReportDesigner. For more information on how to access the C1ReportDesigner, see Accessing C1ReportDesigner from Visual Studio.
    2. Create a new report or open an existing report. Once you have the report in the C1ReportDesigner, you can modify the report properties.
    3. Click the Close Print Preview button to begin editing the report.
    4. In Design mode, select your report from the drop-down list above the Properties window.
    5. Locate Layout and expand the property node to view all available properties.
    6. Set the Custom Height property to 25" or 25in.

      Notice that the measurement is converted into twips automatically. The Property window display the measurement in twips (36000).

    7. Set the Custom Width property to 11" or 11in.

      The Property window displays the measurement in twips (15840).

    8. Set the PaperSize property to Custom.

    To specify a custom paper size of 25" x 11" for your report using code:

    Regardless of what is available on the printer, the following code sets the report paper to 25" x 11":

    To write code in Visual Basic

    Visual Basic
    Copy Code
    c1r.Layout.PaperSize = PaperKind.Custom
    c1r.Layout.CustomHeight = 25 * 1440 ' in twips
    c1r.Layout.CustomWidth = 11 * 1440
    

    To write code in C#

    C#
    Copy Code
    c1r.Layout.PaperSize = PaperKind.Custom;
    c1r.Layout.CustomHeight = 25 * 1440; // in twips
    c1r.Layout.CustomWidth = 11 * 1440;
    
    Note: For the complete report, see report "02: Custom Paper Size" in the CommonTasks.xml report definition file, which is available in the ComponentOne Samples folder.