Set page margins to zero without using pagesettings

Posted by: subhasish on 17 January 2022, 7:21 pm EST

  • Posted 17 January 2022, 7:21 pm EST

    We are having a section report (page header/footer, detail, group header) and we are setting the report specific parameters (left, right .top, bottom margins, print width) dynamically from back end table data. We have used total four text fields in page header/footer and detail sections. Out of these four text boxes, the leftmost and rightmost ones are used to set the page margin (left, right, top & bottom) by setting their width and height in code like below:

    this.txtleftMargin.Width = leftMargin; // variable populated from table data
    this.txtRightMargin.Width = rightMargin; // variable populated from table data
    // same for top and bottom margin we are using text box height

    In ReportStart event we are setting all the margins to 0.

    The issue is, in spite of setting the print width and the left and right margins, active reports 6 seems to ignore the settings and leaving a empty space at the right margin section (after the right margin text box)

  • Posted 18 January 2022, 6:11 pm EST

    Hi Subhasish,

    You are observing this behavior because even though the margins are set to zero the report is still being rendered on the Default PaperKind setting (i.e. Letter). Please set the PageSettings.PaperKind to custom and set the PaperWidth as per your requirement. Please refer to the following lines of code for reference.


    this.PageSettings = new GrapeCity.ActiveReports.PageSettings()


    Margins = new Margins()


    Left = 0,

    Right = 0,

    Bottom = 0,

    Top = 0



    PaperHeight=9f, //Letter width=11 and margin=1 => 11-1*2=9



Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels