提交 d9468902 编写于 作者: S serge-rider

XLSX export: boolean cells export

上级 e4d34558
...@@ -18,8 +18,8 @@ ...@@ -18,8 +18,8 @@
<property id="nullString" label="%dataTransfer.processor.xlsx.property.nullString.name" type="string" description="%dataTransfer.processor.xlsx.property.nullString.description" defaultValue="" required="false"/> <property id="nullString" label="%dataTransfer.processor.xlsx.property.nullString.name" type="string" description="%dataTransfer.processor.xlsx.property.nullString.description" defaultValue="" required="false"/>
<property id="header" label="%dataTransfer.processor.xlsx.property.header.name" type="boolean" description="%dataTransfer.processor.xlsx.property.header.description" defaultValue="true" required="true"/> <property id="header" label="%dataTransfer.processor.xlsx.property.header.name" type="boolean" description="%dataTransfer.processor.xlsx.property.header.description" defaultValue="true" required="true"/>
<property id="headerfont" label="%dataTransfer.processor.xlsx.property.headerFont.name" type="string" description="%dataTransfer.processor.xlsx.property.headerFont.description" defaultValue="BOLD" required="false" validValues="NONE,BOLD,ITALIC,STRIKEOUT,UNDERLINE"/> <property id="headerfont" label="%dataTransfer.processor.xlsx.property.headerFont.name" type="string" description="%dataTransfer.processor.xlsx.property.headerFont.description" defaultValue="BOLD" required="false" validValues="NONE,BOLD,ITALIC,STRIKEOUT,UNDERLINE"/>
<property id="trueString" label="%dataTransfer.processor.xlsx.property.boolStringTrue.name" type="string" description="%dataTransfer.processor.xlsx.property.boolStringTrue.description" defaultValue="+" required="false"/> <property id="trueString" label="%dataTransfer.processor.xlsx.property.boolStringTrue.name" type="string" description="%dataTransfer.processor.xlsx.property.boolStringTrue.description" defaultValue="true" required="false"/>
<property id="falseString" label="%dataTransfer.processor.xlsx.property.boolStringFalse.name" type="string" description="%dataTransfer.processor.xlsx.property.boolStringFalse.description" defaultValue="-" required="false"/> <property id="falseString" label="%dataTransfer.processor.xlsx.property.boolStringFalse.name" type="string" description="%dataTransfer.processor.xlsx.property.boolStringFalse.description" defaultValue="false" required="false"/>
<property id="exportSql" label="%dataTransfer.processor.xlsx.property.exportSql.name" type="boolean" description="%dataTransfer.processor.xlsx.property.exportSql.description" defaultValue="false" required="false"/> <property id="exportSql" label="%dataTransfer.processor.xlsx.property.exportSql.name" type="boolean" description="%dataTransfer.processor.xlsx.property.exportSql.description" defaultValue="false" required="false"/>
<property id="splitSqlText" label="%dataTransfer.processor.xlsx.property.splitSqlText.name" type="boolean" description="%dataTransfer.processor.xlsx.property.splitSqlText.description" defaultValue="false" required="false"/> <property id="splitSqlText" label="%dataTransfer.processor.xlsx.property.splitSqlText.name" type="boolean" description="%dataTransfer.processor.xlsx.property.splitSqlText.description" defaultValue="false" required="false"/>
<property id="splitByRowCount" label="%dataTransfer.processor.xlsx.property.splitByRowCount.name" type="integer" description="%dataTransfer.processor.xlsx.property.splitByRowCount.description" defaultValue="1048575" required="false"/> <property id="splitByRowCount" label="%dataTransfer.processor.xlsx.property.splitByRowCount.name" type="integer" description="%dataTransfer.processor.xlsx.property.splitByRowCount.description" defaultValue="1048575" required="false"/>
......
...@@ -85,8 +85,9 @@ public class DataExporterXLSX extends StreamExporterAbstract { ...@@ -85,8 +85,9 @@ public class DataExporterXLSX extends StreamExporterAbstract {
private boolean printHeader = false; private boolean printHeader = false;
private boolean rowNumber = false; private boolean rowNumber = false;
private String boolTrue = "YES"; private String boolTrue = "true";
private String boolFalse = "NO"; private String boolFalse = "false";
private boolean booleRedefined;
private boolean exportSql = false; private boolean exportSql = false;
private boolean splitSqlText = false; private boolean splitSqlText = false;
...@@ -105,8 +106,8 @@ public class DataExporterXLSX extends StreamExporterAbstract { ...@@ -105,8 +106,8 @@ public class DataExporterXLSX extends StreamExporterAbstract {
properties.put(DataExporterXLSX.PROP_HEADER, true); properties.put(DataExporterXLSX.PROP_HEADER, true);
properties.put(DataExporterXLSX.PROP_NULL_STRING, null); properties.put(DataExporterXLSX.PROP_NULL_STRING, null);
properties.put(DataExporterXLSX.PROP_HEADER_FONT, "BOLD"); properties.put(DataExporterXLSX.PROP_HEADER_FONT, "BOLD");
properties.put(DataExporterXLSX.PROP_TRUESTRING, "+"); properties.put(DataExporterXLSX.PROP_TRUESTRING, "true");
properties.put(DataExporterXLSX.PROP_FALSESTRING, "-"); properties.put(DataExporterXLSX.PROP_FALSESTRING, "false");
properties.put(DataExporterXLSX.PROP_EXPORT_SQL, false); properties.put(DataExporterXLSX.PROP_EXPORT_SQL, false);
properties.put(DataExporterXLSX.PROP_SPLIT_SQLTEXT, false); properties.put(DataExporterXLSX.PROP_SPLIT_SQLTEXT, false);
properties.put(DataExporterXLSX.PROP_SPLIT_BYROWCOUNT, EXCEL2007MAXROWS); properties.put(DataExporterXLSX.PROP_SPLIT_BYROWCOUNT, EXCEL2007MAXROWS);
...@@ -120,84 +121,53 @@ public class DataExporterXLSX extends StreamExporterAbstract { ...@@ -120,84 +121,53 @@ public class DataExporterXLSX extends StreamExporterAbstract {
nullString = nullStringProp == null ? null : nullStringProp.toString(); nullString = nullStringProp == null ? null : nullStringProp.toString();
try { try {
printHeader = (Boolean) site.getProperties().get(PROP_HEADER); printHeader = (Boolean) site.getProperties().get(PROP_HEADER);
} catch (Exception e) { } catch (Exception e) {
printHeader = false; printHeader = false;
} }
try { try {
rowNumber = (Boolean) site.getProperties().get(PROP_ROWNUMBER); rowNumber = (Boolean) site.getProperties().get(PROP_ROWNUMBER);
} catch (Exception e) { } catch (Exception e) {
rowNumber = false; rowNumber = false;
} }
try { try {
boolTrue = (String) site.getProperties().get(PROP_TRUESTRING); boolTrue = (String) site.getProperties().get(PROP_TRUESTRING);
} catch (Exception e) { } catch (Exception e) {
boolTrue = "true";
boolTrue = "YES";
} }
try { try {
boolFalse = (String) site.getProperties().get(PROP_FALSESTRING); boolFalse = (String) site.getProperties().get(PROP_FALSESTRING);
} catch (Exception e) { } catch (Exception e) {
boolFalse = "false";
boolTrue = "NO"; }
if (!"true".equals(boolTrue) || !"false".equals(boolFalse)) {
booleRedefined = true;
} }
try { try {
exportSql = (Boolean) site.getProperties().get(PROP_EXPORT_SQL); exportSql = (Boolean) site.getProperties().get(PROP_EXPORT_SQL);
} catch (Exception e) { } catch (Exception e) {
exportSql = false; exportSql = false;
} }
try { try {
splitSqlText = (Boolean) site.getProperties().get(PROP_SPLIT_SQLTEXT); splitSqlText = (Boolean) site.getProperties().get(PROP_SPLIT_SQLTEXT);
} catch (Exception e) { } catch (Exception e) {
splitSqlText = false; splitSqlText = false;
} }
try { try {
splitByRowCount = (Integer) site.getProperties().get(PROP_SPLIT_BYROWCOUNT); splitByRowCount = (Integer) site.getProperties().get(PROP_SPLIT_BYROWCOUNT);
} catch (Exception e) { } catch (Exception e) {
splitByRowCount = EXCEL2007MAXROWS; splitByRowCount = EXCEL2007MAXROWS;
} }
try { try {
splitByCol = (Integer) site.getProperties().get(PROP_SPLIT_BYCOL); splitByCol = (Integer) site.getProperties().get(PROP_SPLIT_BYCOL);
} catch (Exception e) { } catch (Exception e) {
splitByCol = -1; splitByCol = -1;
} }
...@@ -317,11 +287,6 @@ public class DataExporterXLSX extends StreamExporterAbstract { ...@@ -317,11 +287,6 @@ public class DataExporterXLSX extends StreamExporterAbstract {
super.dispose(); super.dispose();
} }
@Override
public boolean isTextExporter() {
return false;
}
@Override @Override
public void exportHeader(DBCSession session) throws DBException, IOException { public void exportHeader(DBCSession session) throws DBException, IOException {
...@@ -489,7 +454,11 @@ public class DataExporterXLSX extends StreamExporterAbstract { ...@@ -489,7 +454,11 @@ public class DataExporterXLSX extends StreamExporterAbstract {
} }
} else if (row[i] instanceof Boolean) { } else if (row[i] instanceof Boolean) {
cell.setCellValue((Boolean) row[i]); if (booleRedefined) {
cell.setCellValue((Boolean) row[i] ? boolTrue : boolFalse);
} else {
cell.setCellValue((Boolean) row[i]);
}
} else if (row[i] instanceof Number) { } else if (row[i] instanceof Number) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册