TrueDb Grid Print Preview

Posted by: kshitizkumar on 24 July 2019, 9:09 am EST

    • Post Options:
    • Link

    Posted 24 July 2019, 9:09 am EST - Updated 4 October 2022, 1:02 am EST

    Hi,

    I am trying to use the print preview method of printinfo class. In my code the user selected row needs to be previewed. Below is the code i use:

    grdScl.PrintInfo.PageSettings.PrinterSettings.Collate = false;

    grdScl.PrintInfo.PageSettings.PrinterSettings.Copies = 1;

    grdScl.PrintInfo.PageHeaderStyle.Font = new Font(grdScl.PrintInfo.PageHeaderStyle.Font.FontFamily,14,grdScl.PrintInfo.PageHeaderStyle.Font.Style,grdScl.PrintInfo.PageHeaderStyle.Font.Unit,grdScl.PrintInfo.PageHeaderStyle.Font.GdiCharSet,grdScl.PrintInfo.PageHeaderStyle.Font.GdiVerticalFont);

    grdScl.PrintInfo.PageHeader = "\t Schedules ";

    grdScl.PrintInfo.PreviewFormClassName = (“SCHEDULES PRINTPREVIEW”);

    grdScl.PrintInfo.RepeatColumnHeaders = true;

    grdScl.PrintInfo.PageFooter = “\t Page \p of \P”;

    grdScl.PrintInfo.PageSettings = PageSettings;

    grdScl.PrintInfo.PrintPreview();

    As soon as code reaches print preview method. I get a dialog box saying processing document and nothing happens. I dont get the preview page.

    Note that I have 25 columns in my grid.

    I have attached screenshot for reference. Please help.

    Regards,

    Kshitiz

  • Posted 25 July 2019, 12:21 am EST

    Hello,

    By your given code snippet, I am able to get preview that includes all rows of TrueDbGrid but not only the selected rows.

    Print/Preview only the selected rows is not directly possible in the grid. But, as its workaround, you can add these selected rows in another grid and preview that grid.

    I am attaching a sample for your reference, please go through this for better understanding.

    Note : To use PrintPreview method add the reference to C1.Win.C1Report and C1.C1Report / C1.Win.C1Preview and C1.C1Preview.

    If you need any other help, please let me know.

    Thanks and Regards,

    Prabhat Sharma.

    PrintSelectedRowsTDB.zip

Need extra support?

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

Learn More

Forum Channels