locked
C# MVC .rdlc Report perfect 1 report but multiple displays on itself RRS feed

  • Question

  • User-544325736 posted

    Hello everyone,

    I have a C# MVC application when I generate 1 report from a record it loads and works perfectly. When I generate 2 or more reports that is supposed to open in the same PDF window they end up displaying on top of each other. I’m not exactly sure why this is happening I have the page set 8.5 by 11 and correct side and ConsumeContainerWhitespace = true. In the report my margin is ,,, so all 0. Maybe one of you will see something that should be changed. Here is my code.

    case "Generate All":
                        LocalReport localReport = new LocalReport()
                        {
                            ReportPath = Server.MapPath("~/ReportForms/VirtualService3.rdlc")
                        };                                                            
                        ReportDataSource rds = new ReportDataSource("Service_Fields", model.ListQuotes); 
                        localReport.DataSources.Add(rds);
    
                        string reportType = "PDF";
                        string mimeType, encoding, fileNameExtension;
    
                        string deviceInfo =
                            "<DeviceInfo>" +
                            "   <OutputFormat>"+reportType+"</OutputFormat>" +
                            "   <PageWidth>8.5in</PageWidth>" +
                            "   <PageHeight>11in</PageHeight>" +
                            "   <MarginTop>0.5in</MarginTop>" +
                            "   <MarginLeft>0in</MarginLeft>" +
                            "   <MarginRight>0in</MarginRight>" +
                            "   <MarginBottom>0in</MarginBottom>" +
                            "</DeviceInfo>";
    
                        Warning[] warnings;
                        string[] streams;
                        byte[] renderedBytes;
                        //localReport.GetParameters();
    
                        renderedBytes = localReport.Render(
                            reportType,
                            deviceInfo,
                            out mimeType,
                            out encoding,
                            out fileNameExtension,
                            out streams,
                            out warnings);                   
    
                        return File(renderedBytes, mimeType);
                }
    
                //model.List = getter.GetRows(query);
                //testGenerator(model.List);
                //model.Settings = GetTableSettings();
    
                return View("VirtualService", model);
    

    Monday, October 21, 2019 9:52 PM

All replies

  • User475983607 posted

    In my experience, you need to create sub reports to have multiple reports in the same PDF.  

    Monday, October 21, 2019 10:18 PM