2

私は ASP.NET MVC を使用しており、ビューで rdlc をレンダリングしたいと考えています。rdlc ファイルをレンダリングするコードを次に示します。

[HttpPost]
        public ActionResult DepartmentwiseInwardOutwardReport(int? fd, int? td, string fdt, string tdt)
        {
            TrackBL trackBL = new TrackBL();
            IEnumerable<TrackModel> trackList = trackBL.GetDeptInwardOutwardReport(fd, td, fdt, tdt);
            //return PartialView("_TrackingSearchReport", trackList);
            LocalReport localReport = new LocalReport();
            localReport.ReportPath = Server.MapPath("~/Content/Reports/FileMovement.rdlc");
            ReportDataSource reportDataSource = new ReportDataSource("Customers", trackList);
            reportDataSource.Name = "FTSDataSet_proc_File_InwardOutWardReport";
            localReport.DataSources.Add(reportDataSource);
            string reportType = "PDF";
            string mimeType;
            string encoding;
            string fileNameExtension;


            //The DeviceInfo settings should be changed based on the reportType
            //http://msdn2.microsoft.com/en-us/library/ms155397.aspx

            string deviceInfo =
            "<DeviceInfo>" +
            "  <OutputFormat>PDF</OutputFormat>" +
            "  <PageWidth>8.5in</PageWidth>" +
            "  <PageHeight>11in</PageHeight>" +
            "  <MarginTop>0.5in</MarginTop>" +
            "  <MarginLeft>1in</MarginLeft>" +
            "  <MarginRight>1in</MarginRight>" +
            "  <MarginBottom>0.5in</MarginBottom>" +
            "</DeviceInfo>";



            Warning[] warnings;
            string[] streams;
            byte[] renderedBytes;

            //Render the report
            renderedBytes = localReport.Render(
                reportType,
                deviceInfo,
                out mimeType,
                out encoding,
                out fileNameExtension,
                out streams,
                out warnings);

            //Response.AddHeader("content-disposition", "attachment; filename=NorthWindCustomers." + fileNameExtension);
            return File(renderedBytes, mimeType);

これをビューでレンダリングすると、14 ページが表示されます。現在、表示するのは 1 行だけです。それぞれ 2 つの列がページに表示されます。すべての列が他の列の横に表示されるレポートのように表示したい。いくつかの設定がありませんか? 助言がありますか?

4

1 に答える 1

0

MVC3 や MVC4 で RDLC を使用していますが、RDLC レポート自体に関連していると思いますが、直面している問題はありません。ページの幅が非常に大きいため、14 ページに歪んでいる可能性があります (時々向きを設定するのを忘れて、列の数が多いと、3 ページにワープします。

レポートの幅を印刷しようとしているページよりも大きく設定すると、レポートはページに合わせて自動的に分割されます。

于 2012-07-26T07:50:41.693 に答える