how to get header properly while fetching to excel file

Viewed 32

I have a file stored in blob in the database and I'm able to download the file on click to excel. Problem is that the header is coming in one line in spread on different columns because of after each column "\"\t\"" "\t"

how to fix these

ByteArrayOutputStream out = new ByteArrayOutputStream();
OutputStreamWriter osw = new OutputStreamWriter(out, "ISO8859_1");
ecsvp_en = new ExcelCSVPrinter(osw);
String[] headers = list.get(0);
//Column Headers
ecsvp_en.println(headers);

// Data
int rowCount;
for (rowCount = 1; rowCount < list.size(); rowCount++) {
    row = list.get(rowCount);
    ecsvp_en.println(row);
}

                    

Actual header :

"Contract Record Type\"\t\"Contract Type\"\t\"Contract Number\"\t\"Original Contract: Contract Number\"\t\"Contract Line Item Number\"\t\"Product: Product Name\"\t\"Name\"\t\"BMT #\"\t\"Service Status\"\t\"Created Date\"\t\"Effective Date"

Expected header :

"Contract Record Type\tContract Type\tContract Number\tOriginal Contract: Contract Number\tContract Line Item Number\tProduct: Product Name\tName\tBMT #\tService Status\tCreated Date\tEffective Date"
0 Answers
Related