I am printing some data into a CSV file using Apache Commns CSV
. One of the fields contains 15 digit number and is of type String
. This field prints as exponential number in CSV instead of a complete number. I know Excel
does that but is there a way in java to print it as a complete number.
I am not doing anything special. Initially I thought that Commons CSV
will take care of it.
public void createCSV(){
inputStream = new FileInputStream("fileName");
fileWriter = new FileWriter("fileName");
csvFileFormat = CSVFormat.Excel.withHeader("header1", "header2");
csvFilePrinter = new CSVPrinter(fileWriter, csvFileFormat);
for(List<UiIntegrationDTO dto: myList>){
String csvData = dto.getPolicyNumber();
csvFilePrinter.PrintRecord(csvData);
}
}