예제 #1
0
        public ActionResult Index(long id)
        {
            var tempalte = _TemplateAppService.GetReportTemplateById(id);

            _webReport.Report.Load(System.AppDomain.CurrentDomain.BaseDirectory + tempalte.Result.FilePath);

            var dicParameter = Request["parameterValues"].ToObject <Dictionary <string, string> >();

            var listDs = _DataSourceAppService.GetDataSource(id, dicParameter).Result;

            foreach (var ds in listDs)
            {
                _webReport.Report.RegisterData(ds, ds.DataSetName);
            }

            _webReport.Width  = Unit.Percentage(100);
            _webReport.Height = Unit.Percentage(100);

            #region 预览
            _webReport.CurrentTab.Name    = tempalte.Result.TemplateName;
            _webReport.ToolbarIconsStyle  = ToolbarIconsStyle.Black;
            _webReport.ShowToolbar        = true;
            _webReport.SinglePage         = true;
            _webReport.ShowTabCloseButton = true;
            _webReport.TabPosition        = TabPosition.InsideToolbar;

            #endregion
            #region 导出
            //_webReport.Export();
            //FastReport.Cloud.StorageClient.Ftp.FtpStorageClient ftp = new FastReport.Cloud.StorageClient.Ftp.FtpStorageClient();
            //FastReport.Export.Pdf.PDFExport pdf = new FastReport.Export.Pdf.PDFExport();
            //ftp.Server = "10.50.239.68";
            //ftp.Username = "******";
            //ftp.Password = "******";
            //_webReport.Report.Prepare();
            //ftp.SaveReport(_webReport.Report, pdf);
            #endregion

            #region 设计
            //_webReport.DesignReport = true;
            //_webReport.DesignScriptCode = false;
            //_webReport.Debug = true;
            //_webReport.DesignerPath = "~/Areas/ReportManager/Views/WebReportDesigner/index.html";
            //_webReport.DesignerSaveCallBack = "~/Areas/ReportManager/Designer/SaveDesignedReport";
            //_webReport.ID = "DesignReport";
            //_webReport.XlsxPageBreaks = false;
            //_webReport.XlsxSeamless = true;
            #endregion

            ViewBag.WebReport = _webReport;

            var viewModel = new ReportTemplateOutputDto()
            {
                //给属性赋值
            };

            return(View(viewModel));
        }
        public async Task <PartialViewResult> CreateModal()
        {
            var viewModel = new ReportTemplateOutputDto()
            {
                //给属性赋值
            };
            var categories = await _CategoryAppService.GetCategoriesToItem(0);

            ViewBag.Categories = categories;
            return(PartialView("_CreateOrEditModal", viewModel));
        }
예제 #3
0
        public ActionResult Index(long id)
        {
            //string report_path = Request.PhysicalApplicationPath;

            //DataSet ds = new DataSet();
            //ds.DataSetName = "BaseUsers";
            //DataTable dt = new DataTable();
            //dt.TableName = "BaseUsers";
            //dt.Columns.Add("Id");
            //dt.Columns.Add("Name");

            //for (int i = 0; i < 100; i++)
            //{
            //    DataRow dr = dt.NewRow();
            //    dr["Id"] = i.ToString();
            //    dr["Name"] = "test" + i.ToString();
            //    dt.Rows.Add(dr);
            //}
            //ds.Tables.Add(dt);

            //TableDataSource datasource = _webReport.Report.GetDataSource("protable") as TableDataSource;

            //_webReport.Report.RegisterData(ds, "BaseUsers");

            var tempalte = _TemplateAppService.GetReportTemplateById(id);

            _webReport.Report.Load(System.AppDomain.CurrentDomain.BaseDirectory + tempalte.Result.FilePath);

            _webReport.Width  = Unit.Percentage(100);
            _webReport.Height = Unit.Percentage(100);

            #region 预览
            //_webReport.ToolbarIconsStyle = ToolbarIconsStyle.Black;
            //_webReport.ShowToolbar = false;
            //_webReport.SinglePage = true;
            #endregion

            #region 设计

            _webReport.DesignReport     = true;
            _webReport.DesignScriptCode = true;
            _webReport.Debug            = true;
            //_webReport.DesignerPath = "~/Areas/ReportManager/Views/WebReportDesigner/index.html";
            _webReport.DesignerPath         = "~/WebReportDesigner/index.html";
            _webReport.DesignerSaveCallBack = "~/ReportManager/Designer/SaveDesignedReport";
            _webReport.DesignerSavePath     = "~/App_Data/DesignedReports";
            //_webReport.DesignerLocale = "cn";
            _webReport.ID             = id.ToString();
            _webReport.XlsxPageBreaks = false;
            _webReport.XlsxSeamless   = true;
            #endregion

            ViewBag.WebReport = _webReport;

            var viewModel = new ReportTemplateOutputDto()
            {
                //给属性赋值
            };

            return(View(viewModel));
        }