Ignore:
Timestamp:
Mar 22, 2010, 2:18:30 PM (13 years ago)
Author:
tabma
Message:
  • imported data is now being saved in the database (be sure that you choose the correct fieldtypes anywhere/anytime when testing with the Study Excel file)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/taglib/dbnp/importer/ImporterTagLib.groovy

    r283 r297  
    1717import dbnp.studycapturing.Template
    1818import dbnp.studycapturing.TemplateFieldType
     19import org.apache.poi.hssf.usermodel.HSSFCell
     20import org.apache.poi.ss.usermodel.DataFormatter
    1921
    2022class ImporterTagLib {
     
    160162        out << res
    161163    }
     164
     165    /**
     166    * @param cell HSSFCell variable
     167    * @return good representation of variable (instead of toString())
     168    */
     169    def displayCell = { attrs ->       
     170        def cell = attrs['cell']
     171        def df = new DataFormatter()
     172
     173        switch (cell.getCellType()) {
     174            case HSSFCell.CELL_TYPE_STRING      :   out << cell.getStringCellValue()
     175                                                    break
     176            case HSSFCell.CELL_TYPE_NUMERIC     :   out << df.formatCellValue(cell)
     177                                                    break
     178        }
     179    }
    162180}
Note: See TracChangeset for help on using the changeset viewer.