Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
Y
yn-health-science
Project
Project
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
徐俊
yn-health-science
Commits
fc09e62d
Commit
fc09e62d
authored
Feb 12, 2025
by
徐俊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
xujun
parent
3ceafef0
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
40 additions
and
16 deletions
+40
-16
ProjectInfoToPDF.java
...main/java/com/yiboshi/science/utils/ProjectInfoToPDF.java
+40
-16
No files found.
science-admin/src/main/java/com/yiboshi/science/utils/ProjectInfoToPDF.java
View file @
fc09e62d
...
...
@@ -38,6 +38,8 @@ public class ProjectInfoToPDF {
// 添加项目内容章节
addSection
(
document
,
"一、项目基本情况"
,
boldFont
);
addContent
(
document
,
project
.
getResearchContent
(),
normalFont
);
// 添加新页面
document
.
newPage
();
addSection
(
document
,
"二、主要技术指标"
,
boldFont
);
addContent
(
document
,
project
.
getTechnologyTarget
(),
normalFont
);
...
...
@@ -82,7 +84,31 @@ public class ProjectInfoToPDF {
}
}
//首页
/**
* 格式化起止年限
* @param date 开始日期
* @return 格式化后的日期范围字符串
*/
private
static
String
formatDateRange
(
Date
date
,
int
type
)
{
// 定义日期格式
SimpleDateFormat
sdf
;
if
(
type
==
1
)
sdf
=
new
SimpleDateFormat
(
"yyyy年MM月"
);
else
sdf
=
new
SimpleDateFormat
(
"yyyy年MM月dd日"
);
return
sdf
.
format
(
date
);
}
/**
* 首页项目信息
* @param document
* @param project
* @param bfChinese
* @param fsChinese
* @return
* @throws DocumentException
*/
private
static
Document
FirstPageInfo
(
Document
document
,
ComProjectDTO
project
,
BaseFont
bfChinese
,
BaseFont
fsChinese
)
throws
DocumentException
{
Font
titleFont
=
new
Font
(
bfChinese
,
20
,
Font
.
BOLD
);
...
...
@@ -150,22 +176,13 @@ public class ProjectInfoToPDF {
}
/**
* 格式化起止年限
* @param date 开始日期
* @return 格式化后的日期范围字符串
* 添加首页项目表格信息
* @param table
* @param label
* @param value
* @param labelFont
* @param valueFont
*/
private
static
String
formatDateRange
(
Date
date
,
int
type
)
{
// 定义日期格式
SimpleDateFormat
sdf
;
if
(
type
==
1
)
sdf
=
new
SimpleDateFormat
(
"yyyy年MM月"
);
else
sdf
=
new
SimpleDateFormat
(
"yyyy年MM月dd日"
);
return
sdf
.
format
(
date
);
}
//添加首页项目表格信息
private
static
void
addTableRow
(
PdfPTable
table
,
String
label
,
String
value
,
Font
labelFont
,
Font
valueFont
)
{
// 标签单元格
PdfPCell
labelCell
=
new
PdfPCell
(
new
Phrase
(
label
,
labelFont
));
...
...
@@ -207,6 +224,13 @@ public class ProjectInfoToPDF {
table
.
addCell
(
valueCell
);
}
/**
* 项目级别信息
*/
private
static
void
addProjectBasicTable
()
{
}
private
static
void
addSection
(
Document
document
,
String
title
,
Font
font
)
throws
DocumentException
{
Paragraph
section
=
new
Paragraph
(
title
,
font
);
section
.
setSpacingBefore
(
15
);
...
...
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