Java code to set column width in CSV file

Can someone help on how to set the column width in CSV file using javacode.
I have used FileWriter class to upload data into the csv file. Results are getting populated properly but csv file showing results with default column width. Is there a way we can set the width of the column dynamically based on result length or set fixed length?

Questions by 19swapna84

Showing Answers 1 - 2 of 2 Answers

Account,LastName,FirstName,Balance,CreditLimit,AccountCreated,Rating
101,Reeves,Keanu,9315.45,10000.00,1/17/1998,A
312,Butler,Gerard,90.00,1000.00,8/6/2003,B
868,Hewitt,Jennifer Love,0,17000.00,5/25/1985,B
761,Pinkett-Smith,Jada,49654.87,100000.00,12/5/2006,A
317,Murray,Bill,789.65,5000.00,2/5/2007,C


Code
  1. span style="color: #ff0000;">"example/data/input/credit-balance-01.csv""example/data/output/credit-balance-02.fw"


  Was this answer useful?  Yes

Dusmanta

  • Nov 12th, 2014
 

Use Apachae POI jar for this
HSSFSheet sheet = workBook.createSheet("testXls");

Code
  1. // Code to Auto size the column widths

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions