forked from LupusNobilis/java-org.hwo
CSV Update
This commit is contained in:
parent
3a674f57ea
commit
a6cac2bff9
|
@ -218,7 +218,11 @@ public class CSV {
|
||||||
if (String.class.isInstance(record.getValue(i)))
|
if (String.class.isInstance(record.getValue(i)))
|
||||||
writer.write(enclosedBy);
|
writer.write(enclosedBy);
|
||||||
|
|
||||||
writer.write(record.getValue(i).toString());
|
if (Float.class.isInstance(record.getValue(i))){
|
||||||
|
writer.write(String.format("%.4f", record.getValue(i)));
|
||||||
|
} else {
|
||||||
|
writer.write(record.getValue(i).toString());
|
||||||
|
}
|
||||||
|
|
||||||
if (String.class.isInstance(record.getValue(i)))
|
if (String.class.isInstance(record.getValue(i)))
|
||||||
writer.write(enclosedBy);
|
writer.write(enclosedBy);
|
||||||
|
@ -253,6 +257,12 @@ public class CSV {
|
||||||
}
|
}
|
||||||
|
|
||||||
public CSVRecord getRecord(int row){
|
public CSVRecord getRecord(int row){
|
||||||
|
if (row >= records.size()){
|
||||||
|
int size = records.size();
|
||||||
|
for (int i=0;i<=(row-size);i++){
|
||||||
|
records.add(new CSVRecord());
|
||||||
|
}
|
||||||
|
}
|
||||||
return records.get(row);
|
return records.get(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,11 @@ public class CSVRecord {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setValue(int column,Object value){
|
public void setValue(int column,Object value){
|
||||||
|
if (column >= columns.size()){
|
||||||
|
int size = columns.size();
|
||||||
|
for (int i=0;i<=(column-size);i++)
|
||||||
|
columns.add("");
|
||||||
|
}
|
||||||
columns.set(column, value);
|
columns.set(column, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue