2012-07-04 4 views
2

ASP.NET MVC를 사용 중이고 뷰에서 rdlc를 렌더링하려고합니다. 다음은 rdlc 파일을 렌더링하는 코드입니다.ASP.NET MVC의 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 행만 표시됩니다. 각각 두 개의 열이 페이지에 표시됩니다. 모든 열이 다른 옆에 표시되는 보고서처럼 표시하고 싶습니다. 일부 설정이 누락 되었습니까? 어떤 제안?

답변

0

MVC3 및 심지어 MVC4에서 RDLC를 사용하는 경우 RDLC 보고서 자체와 관련이 있다고 생각할지라도 문제가있는 것은 아닙니다. 어쩌면 페이지 폭이 매우 길어서 14 페이지 (오리 엔테이션을 설정하는 것을 잊어 버렸을 때 열이 많으며 3 개의 페이지가 뒤틀리는 경우가 있습니다.)

보고서의 너비를 인쇄하려는 페이지보다 크게 설정하면, 보고서는 페이지에 맞게 자동으로 분할됩니다.

관련 문제