Hi all,
I am exporting my List to CSV file through Servlet. Everything is working fine. but i want to set default/ dynamic width for cell/column?
Here is my coding. Your swift reply will be helpful..
Thanks in advance.
package com.uson.stat.action;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
public class ExportAction extends HttpServlet {
        public void doPost(HttpServletRequest req, HttpServletResponse res)
                        throws ServletException, IOException  {
          res.setContentType("application/CSV");
          res.setHeader("Cache-Control", "public");
          res.setHeader("Pragma", "public");
          res.setHeader("Content-Disposition", "attachment;  filename= \"test.csv"+ "\"");
               String content = "Test Article"+","+"Viewed on 01-02-2010"+","+"Guest";
               System.out.println("content >>>>>>" + content);
           res.getOutputStream().print(content);
        }
}
output will be:
Test Article       Viewed on 01-01-2010      Guest
But output is displaying like this:
Test ArtiViewed on Guest
It is displaying fine in each cell. But I need to increase the size manually in Excel. file. How can i set the cell width dynamically/default size?
How to resolve this?
- Gnaniyar Zubair