Skip to content

Commit 1ea90be

Browse files
committed
pdf优化
1 parent f9de692 commit 1ea90be

35 files changed

+2215
-471
lines changed

end/CellReport.dll

-2 KB
Binary file not shown.

end/cellreport.sln

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ VisualStudioVersion = 17.0.31903.59
44
MinimumVisualStudioVersion = 10.0.40219.1
55
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "reportWeb", "reportWeb\reportWeb.csproj", "{1AB461AC-5D9B-4581-ACB0-B6E35B5200BA}"
66
EndProject
7-
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "html2pdf", "hrml2pdf\html2pdf.csproj", "{5050DEA7-C26B-4332-B2B3-5BA3BDE89911}"
7+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "html2pdf", "html2pdf\html2pdf.csproj", "{7CCE9C4C-459A-4FE6-8A01-57011A90CDE9}"
88
EndProject
99
Global
1010
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -40,26 +40,26 @@ Global
4040
{1AB461AC-5D9B-4581-ACB0-B6E35B5200BA}.Release|Win32.Build.0 = Release|Any CPU
4141
{1AB461AC-5D9B-4581-ACB0-B6E35B5200BA}.Release|x86.ActiveCfg = Release|Any CPU
4242
{1AB461AC-5D9B-4581-ACB0-B6E35B5200BA}.Release|x86.Build.0 = Release|Any CPU
43-
{5050DEA7-C26B-4332-B2B3-5BA3BDE89911}.Debug|.NET.ActiveCfg = Debug|Any CPU
44-
{5050DEA7-C26B-4332-B2B3-5BA3BDE89911}.Debug|.NET.Build.0 = Debug|Any CPU
45-
{5050DEA7-C26B-4332-B2B3-5BA3BDE89911}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
46-
{5050DEA7-C26B-4332-B2B3-5BA3BDE89911}.Debug|Any CPU.Build.0 = Debug|Any CPU
47-
{5050DEA7-C26B-4332-B2B3-5BA3BDE89911}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
48-
{5050DEA7-C26B-4332-B2B3-5BA3BDE89911}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
49-
{5050DEA7-C26B-4332-B2B3-5BA3BDE89911}.Debug|Win32.ActiveCfg = Debug|Any CPU
50-
{5050DEA7-C26B-4332-B2B3-5BA3BDE89911}.Debug|Win32.Build.0 = Debug|Any CPU
51-
{5050DEA7-C26B-4332-B2B3-5BA3BDE89911}.Debug|x86.ActiveCfg = Debug|Any CPU
52-
{5050DEA7-C26B-4332-B2B3-5BA3BDE89911}.Debug|x86.Build.0 = Debug|Any CPU
53-
{5050DEA7-C26B-4332-B2B3-5BA3BDE89911}.Release|.NET.ActiveCfg = Release|Any CPU
54-
{5050DEA7-C26B-4332-B2B3-5BA3BDE89911}.Release|.NET.Build.0 = Release|Any CPU
55-
{5050DEA7-C26B-4332-B2B3-5BA3BDE89911}.Release|Any CPU.ActiveCfg = Release|Any CPU
56-
{5050DEA7-C26B-4332-B2B3-5BA3BDE89911}.Release|Any CPU.Build.0 = Release|Any CPU
57-
{5050DEA7-C26B-4332-B2B3-5BA3BDE89911}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
58-
{5050DEA7-C26B-4332-B2B3-5BA3BDE89911}.Release|Mixed Platforms.Build.0 = Release|Any CPU
59-
{5050DEA7-C26B-4332-B2B3-5BA3BDE89911}.Release|Win32.ActiveCfg = Release|Any CPU
60-
{5050DEA7-C26B-4332-B2B3-5BA3BDE89911}.Release|Win32.Build.0 = Release|Any CPU
61-
{5050DEA7-C26B-4332-B2B3-5BA3BDE89911}.Release|x86.ActiveCfg = Release|Any CPU
62-
{5050DEA7-C26B-4332-B2B3-5BA3BDE89911}.Release|x86.Build.0 = Release|Any CPU
43+
{7CCE9C4C-459A-4FE6-8A01-57011A90CDE9}.Debug|.NET.ActiveCfg = Debug|Any CPU
44+
{7CCE9C4C-459A-4FE6-8A01-57011A90CDE9}.Debug|.NET.Build.0 = Debug|Any CPU
45+
{7CCE9C4C-459A-4FE6-8A01-57011A90CDE9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
46+
{7CCE9C4C-459A-4FE6-8A01-57011A90CDE9}.Debug|Any CPU.Build.0 = Debug|Any CPU
47+
{7CCE9C4C-459A-4FE6-8A01-57011A90CDE9}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
48+
{7CCE9C4C-459A-4FE6-8A01-57011A90CDE9}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
49+
{7CCE9C4C-459A-4FE6-8A01-57011A90CDE9}.Debug|Win32.ActiveCfg = Debug|Any CPU
50+
{7CCE9C4C-459A-4FE6-8A01-57011A90CDE9}.Debug|Win32.Build.0 = Debug|Any CPU
51+
{7CCE9C4C-459A-4FE6-8A01-57011A90CDE9}.Debug|x86.ActiveCfg = Debug|Any CPU
52+
{7CCE9C4C-459A-4FE6-8A01-57011A90CDE9}.Debug|x86.Build.0 = Debug|Any CPU
53+
{7CCE9C4C-459A-4FE6-8A01-57011A90CDE9}.Release|.NET.ActiveCfg = Release|Any CPU
54+
{7CCE9C4C-459A-4FE6-8A01-57011A90CDE9}.Release|.NET.Build.0 = Release|Any CPU
55+
{7CCE9C4C-459A-4FE6-8A01-57011A90CDE9}.Release|Any CPU.ActiveCfg = Release|Any CPU
56+
{7CCE9C4C-459A-4FE6-8A01-57011A90CDE9}.Release|Any CPU.Build.0 = Release|Any CPU
57+
{7CCE9C4C-459A-4FE6-8A01-57011A90CDE9}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
58+
{7CCE9C4C-459A-4FE6-8A01-57011A90CDE9}.Release|Mixed Platforms.Build.0 = Release|Any CPU
59+
{7CCE9C4C-459A-4FE6-8A01-57011A90CDE9}.Release|Win32.ActiveCfg = Release|Any CPU
60+
{7CCE9C4C-459A-4FE6-8A01-57011A90CDE9}.Release|Win32.Build.0 = Release|Any CPU
61+
{7CCE9C4C-459A-4FE6-8A01-57011A90CDE9}.Release|x86.ActiveCfg = Release|Any CPU
62+
{7CCE9C4C-459A-4FE6-8A01-57011A90CDE9}.Release|x86.Build.0 = Release|Any CPU
6363
EndGlobalSection
6464
GlobalSection(SolutionProperties) = preSolution
6565
HideSolutionNode = FALSE

end/html2pdf/Program.cs

Lines changed: 873 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
<TargetFramework>net6.0</TargetFramework>
66
<ImplicitUsings>enable</ImplicitUsings>
77
<Nullable>enable</Nullable>
8+
<NoWarn>$(NoWarn);CS8600;CS8602</NoWarn>
89
</PropertyGroup>
910

1011
<ItemGroup>

end/reportWeb/Controllers/DesignController.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -343,9 +343,9 @@ public async Task<IActionResult> exec_expr(String expr, String report_content)
343343
object exec_result = null;
344344
if (String.IsNullOrEmpty(report_content))
345345
{
346-
BaseExprFaced exprFaced = new ExprFaced2();
347-
exprFaced.addNewScopeForScript();
348346
using Env report_env = new Env("exec_expr1");
347+
BaseExprFaced exprFaced = report_env.getExprFaced();
348+
exprFaced.addNewScopeForScript();
349349
CellReport.dataSet.GroupMap cur_GroupMap = new();
350350
exprFaced.addVariable("env", report_env);
351351
exprFaced.addVariable("__env__", report_env);
@@ -741,7 +741,7 @@ static System.Xml.XmlDocument Content2XmlDoc(string content)
741741
}
742742
}
743743
StringBuilder sb = new();
744-
foreach (Match one in new Regex(@"/\*\s*服务器脚本\s*\\n(.*?)结束\s*\*/").Matches(content))
744+
foreach (Match one in XmlReport.sever_script_regex.Matches(content))
745745
{
746746
sb.AppendLine(one.Groups[1].Value);
747747
}

end/reportWeb/Controllers/PdfController.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public IActionResult Index(string report_obj, string paperSetting)
7777
ps = new PageSetup();
7878
}
7979
var LocalPort = HttpContext.Connection.LocalPort;
80-
dynamic Html2Pdf = Html2Pdf_ctor.Invoke(new object[] { configuration });
80+
dynamic Html2Pdf = Html2Pdf_ctor.Invoke(new object[] { configuration, LocalPort });
8181
Func<Object, List<int>, List<int>, Object> addTable = (rg, row_list, col_list) =>
8282
{
8383
return Html2Pdf.addTable(rg, row_list, col_list);
@@ -88,7 +88,7 @@ public IActionResult Index(string report_obj, string paperSetting)
8888
return rg.output(pdf_doc, ref is_first, addTable);
8989
};
9090
Html2Pdf.output_impl = output_impl;
91-
byte[] result = Html2Pdf.buildPdf(json_root, ps, LocalPort) as byte[];
91+
byte[] result = Html2Pdf.buildPdf(json_root, ps) as byte[];
9292
return File(result, "application/pdf");
9393
}
9494
}
@@ -256,7 +256,7 @@ private static Paragraph replace_var_to_Paragraph(string str, Dictionary<String,
256256
MatchCollection mc = r.Matches(str);//替换#xxx#为 ?,同时记录位置
257257
foreach (Match a in mc)
258258
{
259-
str = str.Replace(a.Value, mark_dict.GetValueOrDefault(a.Groups[1].Value).ToString());
259+
str = str.Replace(a.Value, mark_dict.GetValueOrDefault(a.Groups[1].Value)?.ToString());
260260
}
261261
262262
return convert_html_to_paragraph(str);

0 commit comments

Comments
 (0)