none
各位,ReportView 在webform 的情况下,真的不能动态设置打印纸张大小吗? RRS feed

  • 问题

  • 客户要求打印B5,但是每次控件都按A4来打印,如果要B5,只能手工去设置,大家有没有具体例子,我快被这个问题弄疯了,网上说这个是微软的BUG 的,如果这样的话,ReportView 控件就只能放弃了

    2010年7月27日 3:27

全部回复

  • 我就算将系统里面的打印设置设置成B5,还是不行啊!!!是不是这个是微软的BUG呢???

    2010年7月27日 6:43
  • PrinterSettings   (MSDN)

      // Add list of supported paper sizes found on the printer.
                // The DisplayMember property is used to identify the property that will provide the display string.
                comboPaperSize.DisplayMember = "PaperName";

                PaperSize pkSize;
                for (int i = 0; i < printDoc.PrinterSettings.PaperSizes.Count; i++){
                    pkSize = printDoc.PrinterSettings.PaperSizes[i];
                    comboPaperSize.Items.Add(pkSize);
                }

                // Create a PaperSize and specify the custom paper size through the constructor and add to combobox.
                PaperSize pkCustomSize1 = new PaperSize("First custom size", 100, 200);

                comboPaperSize.Items.Add(pkCustomSize1);

     private void Print()
        {
            const string printerName = "Microsoft Office Document Image Writer";

            if (m_streams == null || m_streams.Count == 0)
                return;

            PrintDocument printDoc = new PrintDocument();
            printDoc.PrinterSettings.PrinterName = printerName;
            if (!printDoc.PrinterSettings.IsValid)
            {
                string msg = String.Format("Can't find printer \"{0}\".", printerName);
                Console.WriteLine(msg);
                return;
            }
            printDoc.PrintPage += new PrintPageEventHandler(PrintPage);
            printDoc.Print();
        }

    2010年7月27日 9:53