title: Need Dynamic/ default width for CSV file when EXPORTING through SERVLET
body: <p>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?</p>
  
  <p>Here is my coding. Your swift reply will be helpful..</p>
  
  <p>Thanks in advance.</p>
  
  <pre><code>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 &gt;&gt;&gt;&gt;&gt;&gt;" + content);
             res.getOutputStream().print(content);
          }
  }
  </code></pre>
  
  <h1>output will be:</h1>
  
  <pre><code>Test Article       Viewed on 01-01-2010      Guest
  </code></pre>
  
  <p>But output is displaying like this:</p>
  
  <pre><code>Test ArtiViewed on Guest
  </code></pre>
  
  <p>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?</p>
  
  <p>How to resolve this?</p>
  
  <ul>
  <li>Gnaniyar Zubair</li>
  </ul>