• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Generation of CSV by servlet

 
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi friends,

Can any one help me regarding the generation of an Excel(CSV) file with the help of a Servlet? I wanted to make the font to bold in the generated csv file for one row.

I have set the contentType of the response object to "text/csv"
and also set the response header 'Content-disposition' to value
"attachment; filename=<myFilename>.csv" . the excel sheet is generated as required. But I wanted to make one of the rows to bold. Can any one please help in in this regard?

Thanks in advance for the response.

Thanks,
Sandeep.
 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
i think you can use similar kind.

HSSFFont boldFont = workBook.createFont();
boldFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);
boldFont.setColor(HSSFColor.WHITE.index);

HSSFCellStyle headerStyle = workBook.createCellStyle();
headerStyle.setFont(boldFont);
using setCellStyle(headerStyle); you can set the style
 
Evelin Priyadarsini
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sorry, i think my above reply will not solve your problem.
i thought you want to manipulate data to excel sheet.
 
Sheriff
Posts: 13411
Firefox Browser VI Editor Redhat
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
CSV just means comma separated values.
There really is no mechanism for formatting the data.

If you need your spreadsheets to have a particular look, you might want to look into some of the third party libraries that can work with real Excel files.

Some of these are listed here.
 
sandeep Kumar
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Thanks Evelin Priyadarsini and Ben Souther. Thanks a lot for giving inputs on this.

Cheers,
Sandeep.
 
reply
    Bookmark Topic Watch Topic
  • New Topic