only whitespace (no functional changes)
git-svn-id: http://google-refine.googlecode.com/svn/trunk@1240 7d457c2a-affb-35e4-300a-418c747d4874
This commit is contained in:
parent
860d6c4ee2
commit
cf66d00854
@ -22,11 +22,11 @@ public class CsvExporter implements Exporter{
|
|||||||
final static Logger logger = LoggerFactory.getLogger("CsvExporter");
|
final static Logger logger = LoggerFactory.getLogger("CsvExporter");
|
||||||
char separator;
|
char separator;
|
||||||
|
|
||||||
public CsvExporter(){
|
public CsvExporter() {
|
||||||
separator = ','; //Comma separated-value is default
|
separator = ','; //Comma separated-value is default
|
||||||
}
|
}
|
||||||
|
|
||||||
public CsvExporter(char separator){
|
public CsvExporter(char separator) {
|
||||||
this.separator = separator;
|
this.separator = separator;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,7 +49,7 @@ public class CsvExporter implements Exporter{
|
|||||||
boolean printColumnHeader = true;
|
boolean printColumnHeader = true;
|
||||||
boolean isFirstRow = true; //the first row should also add the column headers
|
boolean isFirstRow = true; //the first row should also add the column headers
|
||||||
|
|
||||||
public RowVisitor init(CSVWriter writer, boolean printColumnHeader){
|
public RowVisitor init(CSVWriter writer, boolean printColumnHeader) {
|
||||||
this.csvWriter = writer;
|
this.csvWriter = writer;
|
||||||
this.printColumnHeader = printColumnHeader;
|
this.printColumnHeader = printColumnHeader;
|
||||||
return this;
|
return this;
|
||||||
@ -60,18 +60,18 @@ public class CsvExporter implements Exporter{
|
|||||||
String[] vals = new String[row.cells.size()];
|
String[] vals = new String[row.cells.size()];
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
for(Column col : project.columnModel.columns){
|
for (Column col : project.columnModel.columns) {
|
||||||
int cellIndex = col.getCellIndex();
|
int cellIndex = col.getCellIndex();
|
||||||
cols[i] = col.getName();
|
cols[i] = col.getName();
|
||||||
|
|
||||||
Object value = row.getCellValue(cellIndex);
|
Object value = row.getCellValue(cellIndex);
|
||||||
if(value != null){
|
if (value != null) {
|
||||||
vals[i] = value instanceof String ? (String) value : value.toString();
|
vals[i] = value instanceof String ? (String) value : value.toString();
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( printColumnHeader && isFirstRow ){
|
if (printColumnHeader && isFirstRow) {
|
||||||
csvWriter.writeNext(cols,false);
|
csvWriter.writeNext(cols,false);
|
||||||
isFirstRow = false; //switch off flag
|
isFirstRow = false; //switch off flag
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user