Merge branch 'master' of http://47.104.102.122:3000/lpf/SGGL_SeDin_New
This commit is contained in:
@@ -1,6 +1,12 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Web;
|
||||
using System.Web.Security;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Data;
|
||||
using System.Web;
|
||||
using FastReport;
|
||||
|
||||
namespace BLL
|
||||
{
|
||||
public static class FastReportService
|
||||
@@ -30,5 +36,58 @@ namespace BLL
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 合并报表后打印
|
||||
/// </summary>
|
||||
/// <param name="fastReportItems">报表实体集</param>
|
||||
/// <param name="path">导出的路径</param>
|
||||
public static void ExportMergeReport(List<Model.FastReportItem> fastReportItems, string path, string printType)
|
||||
{
|
||||
Report report = new Report();
|
||||
report.PrintSettings.ShowDialog = false; //隐藏弹窗
|
||||
FastReport.EnvironmentSettings settings = new EnvironmentSettings();
|
||||
settings.ReportSettings.ShowProgress = false; //隐藏进度条
|
||||
for (int i = 0; i < fastReportItems.Count; i++)
|
||||
{
|
||||
report.Load(Funs.RootPath + fastReportItems[i].ReportPath); //加载报表
|
||||
|
||||
List<DataTable> dataTables = fastReportItems[i].DataTables;
|
||||
Dictionary<string, string> ParameterValues = fastReportItems[i].ParameterValues;
|
||||
if (dataTables != null && dataTables.Count > 0)
|
||||
{
|
||||
for (int j = 0; j < dataTables.Count; j++)
|
||||
{
|
||||
report.RegisterData(dataTables[j], dataTables[j].TableName);//绑定数据源
|
||||
}
|
||||
}
|
||||
if (ParameterValues.Count > 0)
|
||||
{
|
||||
foreach (KeyValuePair<string, string> kvp in ParameterValues)
|
||||
{
|
||||
report.SetParameterValue(kvp.Key, kvp.Value);//绑定参数
|
||||
}
|
||||
}
|
||||
if (i == 0)
|
||||
{
|
||||
report.Prepare();
|
||||
}
|
||||
else
|
||||
{
|
||||
report.Prepare(true);
|
||||
}
|
||||
}
|
||||
if (printType == "1")
|
||||
{
|
||||
FastReport.Export.Pdf.PDFExport exp = new FastReport.Export.Pdf.PDFExport();
|
||||
report.Export(exp, path);
|
||||
}
|
||||
else if (printType == "2")
|
||||
{
|
||||
FastReport.Export.OoXML.Word2007Export exportBase = new FastReport.Export.OoXML.Word2007Export();
|
||||
report.Export(export: exportBase, fileName: path.Replace(oldValue: "pdf", newValue: "docx"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user