Commit fc09e62d authored by 徐俊's avatar 徐俊

xujun

parent 3ceafef0
...@@ -38,6 +38,8 @@ public class ProjectInfoToPDF { ...@@ -38,6 +38,8 @@ public class ProjectInfoToPDF {
// 添加项目内容章节 // 添加项目内容章节
addSection(document, "一、项目基本情况", boldFont); addSection(document, "一、项目基本情况", boldFont);
addContent(document, project.getResearchContent(), normalFont); addContent(document, project.getResearchContent(), normalFont);
// 添加新页面
document.newPage();
addSection(document, "二、主要技术指标", boldFont); addSection(document, "二、主要技术指标", boldFont);
addContent(document, project.getTechnologyTarget(), normalFont); addContent(document, project.getTechnologyTarget(), normalFont);
...@@ -82,7 +84,31 @@ public class ProjectInfoToPDF { ...@@ -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 { private static Document FirstPageInfo(Document document, ComProjectDTO project, BaseFont bfChinese, BaseFont fsChinese) throws DocumentException {
Font titleFont = new Font(bfChinese, 20, Font.BOLD); Font titleFont = new Font(bfChinese, 20, Font.BOLD);
...@@ -150,22 +176,13 @@ public class ProjectInfoToPDF { ...@@ -150,22 +176,13 @@ public class ProjectInfoToPDF {
} }
/** /**
* 格式化起止年限 * 添加首页项目表格信息
* @param date 开始日期 * @param table
* @return 格式化后的日期范围字符串 * @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) { private static void addTableRow(PdfPTable table, String label, String value, Font labelFont, Font valueFont) {
// 标签单元格 // 标签单元格
PdfPCell labelCell = new PdfPCell(new Phrase(label, labelFont)); PdfPCell labelCell = new PdfPCell(new Phrase(label, labelFont));
...@@ -207,6 +224,13 @@ public class ProjectInfoToPDF { ...@@ -207,6 +224,13 @@ public class ProjectInfoToPDF {
table.addCell(valueCell); table.addCell(valueCell);
} }
/**
* 项目级别信息
*/
private static void addProjectBasicTable() {
}
private static void addSection(Document document, String title, Font font) throws DocumentException { private static void addSection(Document document, String title, Font font) throws DocumentException {
Paragraph section = new Paragraph(title, font); Paragraph section = new Paragraph(title, font);
section.setSpacingBefore(15); section.setSpacingBefore(15);
......
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