0

我在 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

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

4

1 回答 1

0

Under the Report properties there is a Property for Columns.
I have changed this to two(2).
But the default report viewer will not show the columns, nor will they print the columns.

So I exported the report to a PDF and then printed that file.

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);
        }
    }

and then to print i use the print dos command in a new process:

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

The report printed exactly as I needed it to.

于 2012-11-01T12:57:25.197 回答