【问题标题】:Repeating a Table in Columns in RDLC在 RDLC 的列中重复表
【发布时间】:2012-10-31 15:41:41
【问题描述】:

我在 VS2010 RDLC 报告中有一个表格。它会像打印收据一样打印数据,因为我们正在努力节省一些空间。

我想让表格在开始新页面之前作为同一页面上的第二列重复。例如:

Table            Table
Table            Table
Table            Table
Table            Table
Table            Table
=== page break =====

代替

Table
Table
Table
Table
Table
Table
Table
====page break=====
Table
Table
Table

如何在表格中添加第二列?

【问题讨论】:

  • 我刚刚找到了 Number of Columns 的 Report 属性,并将其更改为 2。打印了另一个 Report,但还没有。还在胡闹

标签: c# winforms report rdlc


【解决方案1】:

在报告属性下有一个列属性。
我已将其更改为两个 (2)。
但默认报表查看器不会显示列,也不会打印列。

所以我将报告导出为 PDF,然后打印该文件。

private void Export(LocalReport report)
{
        try
        {
            string deviceInfo =
              @"<DeviceInfo>
            <OutputFormat>PDF</OutputFormat>
            <PageWidth>8.5in</PageWidth>
            <PageHeight>11in</PageHeight>
            <MarginTop>0.25in</MarginTop>
            <MarginLeft>0.25in</MarginLeft>
            <MarginRight>0.25in</MarginRight>
            <MarginBottom>0.25in</MarginBottom>
            </DeviceInfo>";
            Warning[] warnings;
             string[] streamIds;
            string mimeType = string.Empty;
            string encoding = string.Empty;
            string extension = string.Empty;

            m_streams = new List<Stream>();
            byte[] bytes = report.Render("PDF", deviceInfo, out mimeType, out encoding, out extension, out streamIds, out warnings);

            using (FileStream fs = new FileStream("output.pdf", FileMode.Create))
            {
                fs.Write(bytes, 0, bytes.Length);
            }

            foreach (Stream stream in m_streams)
                stream.Position = 0;
        }
        catch (Exception ex)
        {
            Common.LogManager.WriteToLog(ex.Message + Environment.NewLine + ex.StackTrace);
        }
    }

然后打印我在新进程中使用 print dos 命令:

ProcessStartInfo psi = new ProcessStartInfo();
psi.UseShellExecute = true;
psi.Verb = "print";
psi.WindowStyle = ProcessWindowStyle.Hidden;
psi.FileName = "output.pdf";
Process.Start(psi);

报告完全按照我的需要打印。

【讨论】:

    猜你喜欢
    • 2019-02-24
    • 1970-01-01
    • 2011-01-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-03-17
    相关资源
    最近更新 更多