How to excel download (in grid)?

One did not speak English using Google Translator. I hope you do too illogical grammar.

------------------------html------------------------
function doOnLoad() {
var xmlurl=“greenAction.do?mode=planXML”;
mygrid = new dhtmlXGridObject(‘gridbox’);
mygrid.setImagePath(“codebase/imgs/”);
mygrid.setHeader(“,a,b,c,#cspan,d,e,f,g,h”);
mygrid.attachHeader([“#rspan”,“#rspan”,“#rspan”,“1”,“2”,“#rspan”,“#rspan”,“#rspan”,“#rspan”,“#rspan”]);
mygrid.setInitWidths(“50,80,80,80,80,80,80,80,80,80”);
mygrid.setColAlign(“center,left,left,left,left,left,left,left,left,left”);
mygrid.setColTypes(“ch,ro,ro,ro,ro,ro,ro,ro,ro,ro”);
mygrid.setColSorting(“na,str,str,str,str,str,str,str,str,na”);
mygrid.enableMultiline(true);

mygrid.init();
mygrid.setSkin("dhx_skyblue");
mygrid.enableSmartRendering(true, 50);
mygrid.loadXML(xmlurl);
mygrid.attachEvent("onRowSelect",doOnRowSelectedValue);		
//mygrid.enableMultiselect(true); 

//mygrid.enableMultiline(true);
mygrid.attachEvent("onRowSelect",doOnRowSelectedValue);	

}

---------------------------java----------------

public void planXML(HttpServletRequest request,HttpServletResponse response) throws Exception{
	response.setContentType("text/xml;charset=UTF-8");
	response.setHeader("Cache-Control", "no-cache");
	
	List List=greenService.List();
	GridXML jdom = new GridXML(); 
	jdom.autoBeanNoCh(List,"1,2,3,4,5,6,7,8,9,10");
	System.out.println(jdom.toString());
	setInputStream(new ByteArrayInputStream(jdom.getBytes("UTF-8")));
	PrintWriter out = response.getWriter();
	out.print(jdom.toString());
	jdom.close();
}

In this way a java create xml file by calling it, I’m working on the Web

Excel download button and told me to add

-----------------add button------------------------

--------------------------------------------------------------------

Is not that, but not the execution.

How do I download a excel so I do you do?

I’m sorry it’s not enough English, and be sure to please.

If you want to export the data which is already on client side you need to use

parameter of toExcel - path to the conversion script ( not the path to XML generation script )

Thank you so much.

One more question and I’ll.

Download the name change for me what to do?

Whether the download is now heard grid.xml,

I want to give different names, depending on the circumstances.

And give them to check boxes on the front lines
gave a value of 0 for ch, depending on the situation in the very first line, it’s difficult given control?

(Not just get a new grid and receives 0’s got …?) Anyway Thanks for the heads up on how to download

Hi, there is no special API to change grid name.
If you’re using a local export script it may be customized. If you’re using our export service, there is no way to implement it.

If you’re using a local export script it may be customized. If you’re using our export service, there is no way to implement it. <<==

what’s mean local export, our export?
and how to customized change name?

Received XML2Excel How to do?

I’ve copied the entire folder to your project src/com.dhtmlx.xml2excel.

But then I do not know what to do.

Copy and put the web.xml settings are you doing?
Let me explain what to do . ;-( T_T

Hi,
You have to deploy war-file on your server.
After that start deployed application.
Now you can specify path to your server in export call:

grid.toExcel(“http://localhost:8080/grid2excel/generate”);

In com.dhtmlx.xml2excel.ExcelWriter.java you may customize the follow method:

private void outputExcel(HttpServletResponse resp) throws IOException, WriteException {
		resp.setContentType("application/vnd.ms-excel");
		resp.setCharacterEncoding("UTF-8");
		resp.setHeader("Content-Disposition", "attachment;filename=grid.xls");
		resp.setHeader("Cache-Control", "max-age=0");
		wb.write();
		wb.close();
	}

and instead grid.xls generate name which you want.

Thank you, but there’s still a problem.

Under the file (image) as a phenomenon that is repeated twice with the header portion,
utf-8 properly to show garbled text in less than

This represents a good result as shown above.

but

It's not displayed properly, as shown below.

I solve this, we want the latest source.

Anyway, thank you for letting me quickly answer. :slight_smile:


Sorry, I’ve resolved.
Project has the wrong language settings elsewhere, I guess.

do use the original that was used in the project put me right
(And the java from the bottom portion of the part makes sense because commented)
Anyway, thanks very much.