Commit e79cd512 by 施晓雨

更新Nuget版本

parent 7f809d62
...@@ -38,8 +38,9 @@ ...@@ -38,8 +38,9 @@
this.tbxTemplateFileName = new System.Windows.Forms.TextBox(); this.tbxTemplateFileName = new System.Windows.Forms.TextBox();
this.btnSelectTemplateFile = new System.Windows.Forms.Button(); this.btnSelectTemplateFile = new System.Windows.Forms.Button();
this.panel1 = new System.Windows.Forms.Panel(); this.panel1 = new System.Windows.Forms.Panel();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.pgResult = new System.Windows.Forms.PropertyGrid(); this.pgResult = new System.Windows.Forms.PropertyGrid();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.lblSpendTime = new System.Windows.Forms.Label();
this.panel1.SuspendLayout(); this.panel1.SuspendLayout();
this.groupBox1.SuspendLayout(); this.groupBox1.SuspendLayout();
this.SuspendLayout(); this.SuspendLayout();
...@@ -89,7 +90,7 @@ ...@@ -89,7 +90,7 @@
// //
// btnGenerateXlsx // btnGenerateXlsx
// //
this.btnGenerateXlsx.Location = new System.Drawing.Point(374, 72); this.btnGenerateXlsx.Location = new System.Drawing.Point(539, 72);
this.btnGenerateXlsx.Name = "btnGenerateXlsx"; this.btnGenerateXlsx.Name = "btnGenerateXlsx";
this.btnGenerateXlsx.Size = new System.Drawing.Size(112, 23); this.btnGenerateXlsx.Size = new System.Drawing.Size(112, 23);
this.btnGenerateXlsx.TabIndex = 0; this.btnGenerateXlsx.TabIndex = 0;
...@@ -133,6 +134,14 @@ ...@@ -133,6 +134,14 @@
this.panel1.Size = new System.Drawing.Size(339, 736); this.panel1.Size = new System.Drawing.Size(339, 736);
this.panel1.TabIndex = 4; this.panel1.TabIndex = 4;
// //
// pgResult
//
this.pgResult.Dock = System.Windows.Forms.DockStyle.Fill;
this.pgResult.Location = new System.Drawing.Point(0, 95);
this.pgResult.Name = "pgResult";
this.pgResult.Size = new System.Drawing.Size(339, 641);
this.pgResult.TabIndex = 4;
//
// groupBox1 // groupBox1
// //
this.groupBox1.Controls.Add(this.tbxReportId); this.groupBox1.Controls.Add(this.tbxReportId);
...@@ -148,13 +157,14 @@ ...@@ -148,13 +157,14 @@
this.groupBox1.TabStop = false; this.groupBox1.TabStop = false;
this.groupBox1.Text = "获取数据"; this.groupBox1.Text = "获取数据";
// //
// pgResult // lblSpendTime
// //
this.pgResult.Dock = System.Windows.Forms.DockStyle.Fill; this.lblSpendTime.AutoSize = true;
this.pgResult.Location = new System.Drawing.Point(0, 95); this.lblSpendTime.Location = new System.Drawing.Point(375, 83);
this.pgResult.Name = "pgResult"; this.lblSpendTime.Name = "lblSpendTime";
this.pgResult.Size = new System.Drawing.Size(339, 641); this.lblSpendTime.Size = new System.Drawing.Size(65, 12);
this.pgResult.TabIndex = 4; this.lblSpendTime.TabIndex = 1;
this.lblSpendTime.Text = "生成时间:";
// //
// FrmMain // FrmMain
// //
...@@ -164,6 +174,7 @@ ...@@ -164,6 +174,7 @@
this.Controls.Add(this.panel1); this.Controls.Add(this.panel1);
this.Controls.Add(this.tbxTemplateFileName); this.Controls.Add(this.tbxTemplateFileName);
this.Controls.Add(this.label3); this.Controls.Add(this.label3);
this.Controls.Add(this.lblSpendTime);
this.Controls.Add(this.btnSelectTemplateFile); this.Controls.Add(this.btnSelectTemplateFile);
this.Controls.Add(this.btnGenerateXlsx); this.Controls.Add(this.btnGenerateXlsx);
this.Name = "FrmMain"; this.Name = "FrmMain";
...@@ -190,6 +201,7 @@ ...@@ -190,6 +201,7 @@
private System.Windows.Forms.Panel panel1; private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.PropertyGrid pgResult; private System.Windows.Forms.PropertyGrid pgResult;
private System.Windows.Forms.GroupBox groupBox1; private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.Label lblSpendTime;
} }
} }
using Kivii.Client.OfficeSample.Entities; using Kivii.Client.OfficeSample.Entities;
using Kivii.Office.OpenXml.Templates; using Kivii.Office.OpenXml.Excel.Templates;
using System; using System;
using System.Collections.Generic; using System.Diagnostics;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
namespace Kivii.Client.OfficeSample namespace Kivii.Client.OfficeSample
...@@ -51,16 +46,20 @@ namespace Kivii.Client.OfficeSample ...@@ -51,16 +46,20 @@ namespace Kivii.Client.OfficeSample
sfd.Filter = "Excel文件|*.xlsx"; sfd.Filter = "Excel文件|*.xlsx";
if (sfd.ShowDialog() != DialogResult.OK) return; if (sfd.ShowDialog() != DialogResult.OK) return;
var saveFileName = sfd.FileName; var saveFileName = sfd.FileName;
Stopwatch watch = new Stopwatch();
watch.Start();
//创建个模板引擎 //创建个模板引擎
var template = new TemplateExcel(); var template = new TemplateExcel();
template.Open(tbxTemplateFileName.Text);//打开模板文件 template.Open(tbxTemplateFileName.Text);//打开模板文件
template.Bind("contract", _contract);//将数据绑定到模板中,注意contract在模板中这是这个变量名了 template.Bind("contract", _contract);//将数据绑定到模板中,注意contract在模板中这是这个变量名了
template.Fill();//填充模板 var rtns=template.Fill();//填充模板
template.SaveAs(saveFileName);//最后另存当前的文件 template.SaveAs(saveFileName);//最后另存当前的文件
watch.Stop();
lblSpendTime.Text = $"共花费{watch.ElapsedMilliseconds}毫秒,共填充了{rtns.Count}个项目";
} }
} }
} }
...@@ -36,8 +36,8 @@ ...@@ -36,8 +36,8 @@
<HintPath>..\packages\Kivii.Common.5.4.2019.8201\lib\net40\Kivii.Common.V4.0.dll</HintPath> <HintPath>..\packages\Kivii.Common.5.4.2019.8201\lib\net40\Kivii.Common.V4.0.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="Kivii.Office.OpenXml.V4.0, Version=5.4.2019.9100, Culture=neutral, processorArchitecture=MSIL"> <Reference Include="Kivii.Office.OpenXml.V4.0, Version=5.4.2019.9102, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\Kivii.Office.OpenXml.5.4.2019.9100\lib\net40\Kivii.Office.OpenXml.V4.0.dll</HintPath> <HintPath>..\packages\Kivii.Office.OpenXml.5.4.2019.9102\lib\net40\Kivii.Office.OpenXml.V4.0.dll</HintPath>
<Private>True</Private> <Private>True</Private>
</Reference> </Reference>
<Reference Include="System" /> <Reference Include="System" />
......
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<packages> <packages>
<package id="Kivii.Common" version="5.4.2019.8201" targetFramework="net40" /> <package id="Kivii.Common" version="5.4.2019.8201" targetFramework="net40" />
<package id="Kivii.Office.OpenXml" version="5.4.2019.9100" targetFramework="net40" /> <package id="Kivii.Office.OpenXml" version="5.4.2019.9102" targetFramework="net40" />
</packages> </packages>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment