|
|
@@ -234,7 +234,6 @@ public class PDFUtils {
|
|
|
throws DocumentException {
|
|
|
|
|
|
// 添加文档标题(文件名)
|
|
|
- document.add(new Paragraph("Excel文档转换", PDFUtils.getTitleFont()));
|
|
|
document.add(Chunk.NEWLINE);
|
|
|
|
|
|
// 处理每个工作表
|
|
|
@@ -242,9 +241,9 @@ public class PDFUtils {
|
|
|
Sheet sheet = workbook.getSheetAt(i);
|
|
|
|
|
|
// 添加工作表名称
|
|
|
- Paragraph sheetTitle = new Paragraph("工作表: " + sheet.getSheetName(), PDFUtils.getBigFont());
|
|
|
- document.add(sheetTitle);
|
|
|
- document.add(Chunk.NEWLINE);
|
|
|
+// Paragraph sheetTitle = new Paragraph("工作表: " + sheet.getSheetName(), PDFUtils.getBigFont());
|
|
|
+// document.add(sheetTitle);
|
|
|
+// document.add(Chunk.NEWLINE);
|
|
|
|
|
|
// 计算需要的列数
|
|
|
int columnCount = 0;
|
|
|
@@ -280,6 +279,8 @@ public class PDFUtils {
|
|
|
if (rowCount == 0) {
|
|
|
pdfCell.setBackgroundColor(BaseColor.LIGHT_GRAY);
|
|
|
pdfCell.setHorizontalAlignment(Element.ALIGN_CENTER);
|
|
|
+ //第一行合并
|
|
|
+ pdfCell.setColspan(columnCount);
|
|
|
}
|
|
|
|
|
|
table.addCell(pdfCell);
|