Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Poovarasan on Jan 03, 2010 03:32
open dhtmlx forum
Export to excel

Hi,

i am poovarasan. I am using the grid . What ever is showing in the grid page, i like to export into excel format. When i am cliking the Export hyperlink it has to be ported into Excel. So what i have to do to expotr into excel?


my code

if(buttonName.equals("Expression"))
cstmt=dbConn.prepareCall("{? = call DiseaseFocus.AltExpression('"+condnquery+"' )}");

cstmt.registerOutParameter(1,java.sql.Types.CLOB);
cstmt.execute();
java.sql.Clob test2= cstmt.getClob(1);
cstmt.close();
BufferedReader br = new BufferedReader(test2.getCharacterStream());
while ((aux=br.readLine())!=null)
strOut.append(aux);
report=strOut.toString();
report1=report.replaceAll("'","`");

mygrid = new dhtmlXGridObject('gridbox');
    mygrid.hdrSizeA = 300;
    mygrid.setImagePath("../../../js/dhtmlxGrid/codebase/imgs/");
    mygrid.setSkin("light");
    mygrid.enableRowsHover(true,'grid_hover');
    mygrid.init();
    mygrid.enableMultiline(true);
    mygrid.parse('<%=report1%>');
    function onKeyPressed(code,ctrl,shift){
            
                if(code==67&&ctrl){
                    mygrid.setCSVDelimiter("\t")
                    mygrid.copyBlockToClipboard()
                }
                if(code==86&&ctrl){
                    mygrid.pasteBlockFromClipboard()
                }
        return true;
}
    function showClipboard(){
             if (window.clipboardData)
                    document.getElementById("ser_1").value = window.clipboardData.getData("Text");        
    }


Regards,
poovarasan

Answer posted by dhxSupport on Jan 04, 2010 03:28

dhtmlxGrid is fully client side component. Exporting grid to the PDF or Excell file is really server side work. Grid can serialize itself as XML or CSV - which can be used to further transformation on server side. Please see example here http://www.dhtmlx.com/docs/products/dhtmlxGrid/samples/12_initialization_loading/13_pro_load_csv.html

If such functionality is critical in your case you can contact sales@dhtmlx.com and request for component customization.