Ejemplo n.º 1
0
        public FileResult GetZipFile()
        {
            FastReportServiceClient reportServiceClient = new FastReportServiceClient();

            reportServiceClient.ClientCredentials.UserName.UserName = ConfigurationManager.AppSettings["FastReportServiceUserName"];
            reportServiceClient.ClientCredentials.UserName.Password = ConfigurationManager.AppSettings["FastReportServicePassword"];
            reportServiceClient.Open();
            ReportItem reportItem = new ReportItem();

            reportItem.Path = @"Demo reports\Simple List.frx";
            GearItem gearItem = new GearItem();

            gearItem.Name = "FPX";
            ReportRequest request = new ReportRequest();

            request.Report = reportItem;
            request.Gear   = gearItem;
            Stream stream = reportServiceClient.GetReport(request);

            string uuid = reportServiceClient.PutPreparedReport(stream);
            Stream zipStream;

            try
            {
                zipStream = reportServiceClient.GetHTMLByUUID(uuid);
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }

            //Stream pdfStream = reportServiceClient.GetHTML(stream);
            reportServiceClient.Close();
            return(File(zipStream, "application/zip", "report.zip"));
        }
Ejemplo n.º 2
0
        void webReport_StartReport(object sender, EventArgs e)
        {
            (sender as WebReport).ReportDone = true;
            FastReportServiceClient reportServiceClient = new FastReportServiceClient();

            reportServiceClient.ClientCredentials.UserName.UserName = ConfigurationManager.AppSettings["FastReportServiceUserName"];
            reportServiceClient.ClientCredentials.UserName.Password = ConfigurationManager.AppSettings["FastReportServicePassword"];
            reportServiceClient.Open();
            ReportItem reportItem = new ReportItem();

            reportItem.Path = @"Demo reports\Simple List.frx";
            GearItem gearItem = new GearItem();

            gearItem.Name = "FPX";
            ReportRequest request = new ReportRequest();

            request.Report = reportItem;
            request.Gear   = gearItem;
            (sender as WebReport).Report.LoadPrepared(reportServiceClient.GetReport(request));
            reportServiceClient.Close();
        }
Ejemplo n.º 3
0
        public FileResult GetPdfFile()
        {
            FastReportServiceClient reportServiceClient = new FastReportServiceClient();

            reportServiceClient.ClientCredentials.UserName.UserName = ConfigurationManager.AppSettings["FastReportServiceUserName"];
            reportServiceClient.ClientCredentials.UserName.Password = ConfigurationManager.AppSettings["FastReportServicePassword"];
            reportServiceClient.Open();
            ReportItem reportItem = new ReportItem();

            reportItem.Path = @"Demo reports\Simple List.frx";
            GearItem gearItem = new GearItem();

            gearItem.Name = "FPX";
            ReportRequest request = new ReportRequest();

            request.Report = reportItem;
            request.Gear   = gearItem;
            Stream stream    = reportServiceClient.GetReport(request);
            Stream pdfStream = reportServiceClient.GetPDF(stream);

            reportServiceClient.Close();
            return(File(pdfStream, "application/pdf", "report.pdf"));
        }