Announcement Announcement Module
Collapse
No announcement yet.
Problem with Excel view Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Problem with Excel view

    Hi ,

    I have a controller which returns an excel view as follows. Problem is when I access the controller it says 'File Error :data may been lost'. I must be doing something silly here. Please help !!

    public ModelAndView handleRequest(HttpServletRequest request,
    HttpServletResponse respone) throws Exception {



    return new ModelAndView(new ExcelTemplateView());
    }

    public class ExcelTemplateView extends AbstractExcelView
    {


    @Override
    protected void buildExcelDocument(Map map, HSSFWorkbook wb,
    HttpServletRequest request, HttpServletResponse response)
    throws Exception {

    InputStream inStream = null;

    try
    {
    ClassPathResource resource = new
    ClassPathResource("GUITemplateForExcelUpload.xls") ;

    wb = new HSSFWorkbook(resource.getInputStream(),true);

    }
    catch(IOException io)
    catch(Exception io)
    {
    logger.error("Errorwhile trying to open the template file ",io);
    }
    finally
    {
    if(inStream != null)
    {
    //inStream.close();
    }
    }

    }
    The above is the code inside my controller...

  • #2
    Hi all, can anybody please help me with this.. any suggestions will be of gr8 help ..

    Comment

    Working...
    X