回复 11楼wanghongtao的帖子
你好,原因可能为打印之前没有指定纸张大小,请在代码中做如下更改,:
- private void NewActiveReport1_ReportStart(object sender, EventArgs e)
- {
- DataTable dt = new DataTable();
- dt.Columns.Add("a");
- dt.Columns.Add("b");
- DataRow dr;
- for (int i = 0; i < 50; i++)
- {
- dr = dt.NewRow();
- dr["a"] = "a" + i.ToString();
- dr["b"] = "b" + i.ToString();
- dt.Rows.Add(dr);
- }
- this.DataSource = dt;
- this.Document.Printer.PrinterName = "";
- this.PageSettings.DefaultPaperSize = false;
- this.PageSettings.PaperKind = System.Drawing.Printing.PaperKind.A4;
- this.PageSettings.Margins.Top = 0f;
- this.PageSettings.Margins.Bottom = 0f;
- this.PageSettings.Margins.Left = 0f;
- this.PageSettings.Margins.Right = 0f;
- }
复制代码 |