Announcement Announcement Module
No announcement yet.
excel view corrupted Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • excel view corrupted

    Hello. I am creating an excel view extending AbstractExcelView.
    The data is populated from a view (database view). When downloading with Internet Explorer 7, have not tested on others, from the production server it becomes corrupted giving me the alert of:

    The document is corrupted and cannot be opened. Use the repair tool.....etc , it is ok in FireFox

    Now I have been through the forums and found a number of solutions but none have worked.

    I have set it all to no cache using this in the constructor of the controller, with various timing settings
    I have also set the response headers so that the file is copied to a temp directory, res being HttpServletResponse in the ModelAndView onSubmit()
    res.setHeader("Content-Disposition", "attachment; filename=repAllEics.xls");
    I am creating the results of the query but returning unique objects an setting them to a list, if an object is null then I create the object and populate the data. The reason for this is that the report needs the null rows, where a client code does not have any data, to be populated, thus:
     * Returns all details for all client codes that have been entered into the system for 
     * a specific year and a specific form type.  Those codes that have no data entered
     * will still be returned in the result set with the correct client code, form type and year
     * just everything else will be 0
     * @param yr	The year of the report
     * @param formType	The form type of the report 1=activity, 2=workprogram
     * @return	a list of results for every client code
    public List getRepDetailAllEICBlanks(int yr,int formType){
    	List allDetailList = new ArrayList();
    	Session session = HibernateUtil.getSessionFactory().getCurrentSession();
    	//first get all the client codes from the client code table in a different database
    	try{//have tried with iterator and list
    	//Iterator allEicList = session.createQuery("from EIC order by EIC_CODE").list().iterator();
    	List allEicList = session.createQuery("from EIC order by EIC_CODE").list();
    	//now that we have a list of all client jcodes we can go get the results from the database view
    	for(int i=0; i<allEicList.size(); i++){
    		//EIC currentEic = (EIC);
    		EIC currentEic = (EIC)allEicList.get(i);
    		RepDetailedAllEIC res = (RepDetailedAllEIC)session.createQuery("from RepDetailedAllEIC where formYear = ? and formTypeID = ? and eic_code = ?")
    			.setInteger(0, yr)
    			.setInteger(1, formType)
    			.setString(2, currentEic.getEIC_CODE()).uniqueResult();
    	//if there is no result for this client code then populate the main details of the results
    			if(res == null){
    				RepDetailedAllEIC reall = new RepDetailedAllEIC();
    				reall.setFormType("no data");
                                    //add the blank object to the return list
    	catch(HibernateException e){
    			logger.error("***** failed getting all data from the test");
    			throw e;
    	return allDetailList;
    Now this only happens on the production server which is
    • Windows 2000
    • Tomcat 5.5
    • IIS 5
    • Jakarta Isapi

    I do not know if it is anything to do with the server setup but my local, where it works fine is just Tomcat 5.5 accessed directly via the port number.

    Thanks for taking the time to read.