Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
Kivii.Client.OfficeSample
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
示例代码
Kivii.Client.OfficeSample
Commits
17a739a7
Commit
17a739a7
authored
Oct 25, 2019
by
施晓雨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
三个模板合并
parent
5bc5b244
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
21 additions
and
1 deletion
+21
-1
FrmMain.Designer.cs
Kivii.Client.OfficeSample/FrmMain.Designer.cs
+0
-0
FrmMain.cs
Kivii.Client.OfficeSample/FrmMain.cs
+18
-1
Kivii.Client.OfficeSample.csproj
Kivii.Client.OfficeSample/Kivii.Client.OfficeSample.csproj
+3
-0
报告底页.xlsx
Kivii.Client.OfficeSample/报告底页.xlsx
+0
-0
No files found.
Kivii.Client.OfficeSample/FrmMain.Designer.cs
View file @
17a739a7
This diff is collapsed.
Click to expand it.
Kivii.Client.OfficeSample/FrmMain.cs
View file @
17a739a7
...
...
@@ -17,7 +17,9 @@ namespace Kivii.Client.OfficeSample
}
private
void
FrmMain_Load
(
object
sender
,
EventArgs
e
)
{
tbxTemplateFileName
.
Text
=
Path
.
Combine
(
AppDomain
.
CurrentDomain
.
BaseDirectory
,
"附页模板.xlsx"
);
tbxTemplateFileName
.
Text
=
Path
.
Combine
(
AppDomain
.
CurrentDomain
.
BaseDirectory
,
"首页模板.xlsx"
);
tbxTemplateFileName2
.
Text
=
Path
.
Combine
(
AppDomain
.
CurrentDomain
.
BaseDirectory
,
"附页模板.xlsx"
);
tbxTemplateFileName3
.
Text
=
Path
.
Combine
(
AppDomain
.
CurrentDomain
.
BaseDirectory
,
"报告底页.xlsx"
);
dgTasks
.
AutoGenerateColumns
=
false
;
}
private
void
btnGetReport_Click
(
object
sender
,
EventArgs
e
)
...
...
@@ -74,8 +76,15 @@ namespace Kivii.Client.OfficeSample
template2
.
Bind
(
"task"
,
_tasks
);
var
rtns2
=
template2
.
Fill
();
//填充模板
var
template3
=
new
TemplateExcel
();
template3
.
Open
(
tbxTemplateFileName3
.
Text
);
//打开模板文件
template3
.
Bind
(
"contract"
,
_contract
);
//将数据绑定到模板中,注意contract在模板中这是这个变量名了
template3
.
Bind
(
"task"
,
_tasks
);
var
rtns3
=
template3
.
Fill
();
//填充模板
//合并两个模板
template
.
Contact
(
template2
.
Package
);
template
.
Contact
(
template3
.
Package
);
template
.
SaveAs
(
saveFileName
);
//最后另存当前的文件
watch
.
Stop
();
...
...
@@ -89,5 +98,13 @@ namespace Kivii.Client.OfficeSample
if
(
ofd
.
ShowDialog
()
!=
DialogResult
.
OK
)
return
;
tbxTemplateFileName2
.
Text
=
ofd
.
FileName
;
}
private
void
btnSelectTemplateFile3_Click
(
object
sender
,
EventArgs
e
)
{
OpenFileDialog
ofd
=
new
OpenFileDialog
();
ofd
.
Filter
=
"Excel模板文件|*.xlsx"
;
if
(
ofd
.
ShowDialog
()
!=
DialogResult
.
OK
)
return
;
tbxTemplateFileName3
.
Text
=
ofd
.
FileName
;
}
}
}
Kivii.Client.OfficeSample/Kivii.Client.OfficeSample.csproj
View file @
17a739a7
...
...
@@ -85,6 +85,9 @@
<DependentUpon>
Settings.settings
</DependentUpon>
<DesignTimeSharedInput>
True
</DesignTimeSharedInput>
</Compile>
<None
Include=
"报告底页.xlsx"
>
<CopyToOutputDirectory>
Always
</CopyToOutputDirectory>
</None>
<None
Include=
"附页模板.xlsx"
>
<CopyToOutputDirectory>
PreserveNewest
</CopyToOutputDirectory>
</None>
...
...
Kivii.Client.OfficeSample/报告底页.xlsx
0 → 100644
View file @
17a739a7
File added
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment