locked
Crystal report design issue RRS feed

  • Question

  • Hi,

    I have developed my crystal report in A4 size format. I want to change the reports into A3 size format when needed. Can anybody please suggest some solution for this. It will be great help to me.

    Regards,

    Viji


    Best Regards, Dummy Bullet.
    Tuesday, March 15, 2011 11:58 AM

Answers

  • You can change Print size in 2 way

    1. On Crystal Report Design time
       > Go to Design View
       > Right Click on the page
       > Select >> Design >> Print Setup
         Then Print Setup Dialog will appear
        > Then Select > Printer    (Microsoft XPS Document Writter)
            > Then Select > Paper Size (A3)


    2. Chnage Crystal Report Print setup on run time

    cr1 cr = new cr1();// here cr1 is Crystal Report
          string printerName = comboBox1.Text; // Your Printer Name
    
    
          System.Drawing.Printing.PrintDocument doctoprint = new System.Drawing.Printing.PrintDocument();
          doctoprint.PrinterSettings.PrinterName = printerName;
          int rawKind = 0;
          for (int i = 0; i <= doctoprint.PrinterSettings.PaperSizes.Count - 1; i++)
          {
            if (doctoprint.PrinterSettings.PaperSizes[i].PaperName == "A3") // "A3 : Your Page Size"
            {
              rawKind = Convert.ToInt32(doctoprint.PrinterSettings.PaperSizes[i].GetType().GetField
                ("kind",
              System.Reflection.BindingFlags.Instance |
              System.Reflection.BindingFlags.NonPublic).GetValue(doctoprint.PrinterSettings.PaperSizes[i]));
              break; 
            }
          }
          cr.PrintOptions.PaperSize = (CrystalDecisions.Shared.PaperSize)rawKind;
          
          crystalReportViewer1.ReportSource = cr; // Setting Crystal Report to Crystal Report Viewer
    

    For Getting All Printer Name you can use following code

     // You need to add "System.Drawing.Printing" namespace
          foreach (string s in PrinterSettings.InstalledPrinters)
          {
            comboBox1.Items.Add(s);
          }
    
    hope it will help you.


    Hasibul Haque, MCTS http://blog.e-rains.com
    Wednesday, March 16, 2011 4:10 AM
  • I think custom dimension means custom page, am i right?

    If right then you can create custom paper using following way.

    1. Go to printer server (considering win7)

              >> Control panel>> Devices and Printers >> Select Printer >> Then select from the top menu Print Server Properties

              >> Then Check Create New Form

              >> Then give a name of your paper and setup your paper size.

    2. Finally use your custom paper name from your application


    Hasibul Haque, MCPD http://blog.e-rains.com
    Thursday, March 24, 2011 5:42 AM

All replies

  • You can change Print size in 2 way

    1. On Crystal Report Design time
       > Go to Design View
       > Right Click on the page
       > Select >> Design >> Print Setup
         Then Print Setup Dialog will appear
        > Then Select > Printer    (Microsoft XPS Document Writter)
            > Then Select > Paper Size (A3)


    2. Chnage Crystal Report Print setup on run time

    cr1 cr = new cr1();// here cr1 is Crystal Report
          string printerName = comboBox1.Text; // Your Printer Name
    
    
          System.Drawing.Printing.PrintDocument doctoprint = new System.Drawing.Printing.PrintDocument();
          doctoprint.PrinterSettings.PrinterName = printerName;
          int rawKind = 0;
          for (int i = 0; i <= doctoprint.PrinterSettings.PaperSizes.Count - 1; i++)
          {
            if (doctoprint.PrinterSettings.PaperSizes[i].PaperName == "A3") // "A3 : Your Page Size"
            {
              rawKind = Convert.ToInt32(doctoprint.PrinterSettings.PaperSizes[i].GetType().GetField
                ("kind",
              System.Reflection.BindingFlags.Instance |
              System.Reflection.BindingFlags.NonPublic).GetValue(doctoprint.PrinterSettings.PaperSizes[i]));
              break; 
            }
          }
          cr.PrintOptions.PaperSize = (CrystalDecisions.Shared.PaperSize)rawKind;
          
          crystalReportViewer1.ReportSource = cr; // Setting Crystal Report to Crystal Report Viewer
    

    For Getting All Printer Name you can use following code

     // You need to add "System.Drawing.Printing" namespace
          foreach (string s in PrinterSettings.InstalledPrinters)
          {
            comboBox1.Items.Add(s);
          }
    
    hope it will help you.


    Hasibul Haque, MCTS http://blog.e-rains.com
    Wednesday, March 16, 2011 4:10 AM
  • Hi,

    Thank yo uvery much. I have another clarification also. I would like to add a custom dimension for the paper size. How can I add a custom dimension through UI.


    Best Regards, Dummy Bullet.
    Friday, March 18, 2011 4:42 PM
  • I think custom dimension means custom page, am i right?

    If right then you can create custom paper using following way.

    1. Go to printer server (considering win7)

              >> Control panel>> Devices and Printers >> Select Printer >> Then select from the top menu Print Server Properties

              >> Then Check Create New Form

              >> Then give a name of your paper and setup your paper size.

    2. Finally use your custom paper name from your application


    Hasibul Haque, MCPD http://blog.e-rains.com
    Thursday, March 24, 2011 5:42 AM