Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
270
How do I enable printing a range of pages with grid?
posted

I'm using the PrintDialog class with UltraGridPrintDocument.

The PrintDialog has a Page Range section with All, Selection, Current Page, and Pages options.

They are all disabled except for All.  I would like to give users the ability to print a range of pages.  Are there any sample programs that do this?  Any help would be appreciated.

  • 165
    Suggested Answer
    posted

    Inside your button_Click...

    UltraGridPrintDocument doc = new UltraGridPrintDocument();
    doc.Grid = ultraGrid1;
    PrintDialog printDialog1 = new PrintDialog()
    printDialog1.AllowSomePages = true; // This is key
    printDialog1.Settings = doc.Settings;
    if(printDialog1.ShowDialog() == DialogResult.OK)
    {
    doc.Print();
    }
    

    The only gotcha here is that there is no presentation of what 'valid' page ranges are. if you select page 1000, then you're going to get the 'last' page.