This commit is contained in:
2025-08-13 15:56:46 +08:00
116 changed files with 7324 additions and 1325 deletions
+61 -2
View File
@@ -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"));
}
}
}
}