Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
suliangchun
dbeaver
提交
7f5b3ad0
D
dbeaver
项目概览
suliangchun
/
dbeaver
与 Fork 源项目一致
从无法访问的项目Fork
通知
2
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
dbeaver
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
7f5b3ad0
编写于
3月 17, 2018
作者:
S
serge-rider
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
XLS export: auto-size columns
上级
793278f5
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
29 addition
and
2 deletion
+29
-2
plugins/org.jkiss.dbeaver.data.office/src/org/jkiss/dbeaver/data/office/export/DataExporterXLSX.java
...rg/jkiss/dbeaver/data/office/export/DataExporterXLSX.java
+29
-2
未找到文件。
plugins/org.jkiss.dbeaver.data.office/src/org/jkiss/dbeaver/data/office/export/DataExporterXLSX.java
浏览文件 @
7f5b3ad0
...
...
@@ -17,9 +17,14 @@
*/
package
org.jkiss.dbeaver.data.office.export
;
import
com.microsoft.schemas.vml.CTShape
;
import
com.microsoft.schemas.vml.impl.CTShapeImpl
;
import
org.apache.poi.ss.usermodel.*
;
import
org.apache.poi.xssf.model.CommentsTable
;
import
org.apache.poi.xssf.streaming.SXSSFSheet
;
import
org.apache.poi.xssf.streaming.SXSSFWorkbook
;
import
org.apache.poi.xssf.usermodel.XSSFCellStyle
;
import
org.apache.poi.xssf.usermodel.XSSFComment
;
import
org.apache.poi.xssf.usermodel.XSSFFont
;
import
org.jkiss.dbeaver.DBException
;
import
org.jkiss.dbeaver.DBeaverPreferences
;
...
...
@@ -36,6 +41,8 @@ import org.jkiss.dbeaver.tools.transfer.stream.impl.StreamExporterAbstract;
import
org.jkiss.dbeaver.ui.controls.resultset.ResultSetUtils
;
import
org.jkiss.dbeaver.utils.ContentUtils
;
import
org.jkiss.utils.CommonUtils
;
import
org.openxmlformats.schemas.spreadsheetml.x2006.main.CTComment
;
import
org.openxmlformats.schemas.spreadsheetml.x2006.main.impl.CTCommentImpl
;
import
java.io.IOException
;
import
java.io.Reader
;
...
...
@@ -342,27 +349,47 @@ public class DataExporterXLSX extends StreamExporterAbstract {
}
private
void
printHeader
(
Worksheet
wsh
)
{
Row
row
=
wsh
.
getSh
().
createRow
(
wsh
.
getCurrentRow
());
SXSSFSheet
sh
=
(
SXSSFSheet
)
wsh
.
getSh
();
Row
row
=
sh
.
createRow
(
wsh
.
getCurrentRow
());
int
startCol
=
rowNumber
?
1
:
0
;
for
(
int
i
=
0
,
columnsSize
=
columns
.
size
();
i
<
columnsSize
;
i
++)
{
sh
.
trackColumnForAutoSizing
(
i
);
DBDAttributeBinding
column
=
columns
.
get
(
i
);
String
colName
=
column
.
getLabel
();
if
(
CommonUtils
.
isEmpty
(
colName
))
{
colName
=
column
.
getName
();
}
Cell
cell
=
row
.
createCell
(
i
+
startCol
,
CellType
.
STRING
);
if
(
showDescription
)
{
String
description
=
column
.
getDescription
();
if
(!
CommonUtils
.
isEmpty
(
description
))
{
colName
+=
"\n"
+
description
;
/*
// When the comment box is visible, have it show in a 1x3 space
ClientAnchor anchor = wb.getCreationHelper().createClientAnchor();
anchor.setCol1(cell.getColumnIndex());
anchor.setCol2(cell.getColumnIndex()+1);
anchor.setRow1(row.getRowNum());
anchor.setRow2(row.getRowNum()+3);
Comment comment = drawing.createCellComment(anchor);
RichTextString str = wb.getCreationHelper().createRichTextString("Hello, World!");
comment.setString(str);
comment.setAuthor("Apache POI");
*/
}
}
Cell
cell
=
row
.
createCell
(
i
+
startCol
,
CellType
.
STRING
);
cell
.
setCellValue
(
colName
);
cell
.
setCellStyle
(
styleHeader
);
}
for
(
int
i
=
0
,
columnsSize
=
columns
.
size
();
i
<
columnsSize
;
i
++)
{
sh
.
autoSizeColumn
(
i
);
}
wsh
.
incRow
();
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录