Class DataTablesExportToFile


  • public class DataTablesExportToFile
    extends java.lang.Object
    Used to export datatables to either excel or csv formatted files.
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static void writeFile​(DataTablesExportTypes type, javax.servlet.http.HttpServletResponse response, java.lang.String filename, java.util.List<? extends DataTablesExportable> models, java.util.List<java.lang.String> headers)
      Write data within datatable to an excel formatted file.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • DataTablesExportToFile

        public DataTablesExportToFile()
    • Method Detail

      • writeFile

        public static void writeFile​(DataTablesExportTypes type,
                                     javax.servlet.http.HttpServletResponse response,
                                     java.lang.String filename,
                                     java.util.List<? extends DataTablesExportable> models,
                                     java.util.List<java.lang.String> headers)
                              throws java.io.IOException
        Write data within datatable to an excel formatted file.
        Parameters:
        type - DataTablesExportTypes type of file to create (either excel or csv)
        response - HttpServletResponse
        filename - String name of the file to download.
        models - Data to download in the table
        headers - for the table
        Throws:
        java.io.IOException - thrown if file cannot be written