I don’t really know enough about the internals of ASP.NET to say.  I assumed that there was some heavy-duty .NET conversion-to-Excel code being executed, but it sure looks as though an HTML file (or some subset thereof) is being opened as an Excel file.  Is that plausible?

 

I suppose I could experiment by creating an HTML file with a table and renaming it with a .xls suffix to see what happens.  If that works, is there a simple way I could get the HTML text into a string from a Wicket component?  /Frank

 

-----Original Message-----
On Behalf Of Igor Vaynberg,
Wednesday, February 01, 2006 4:13 PM

 

from reading the above code all you are doing is rendering the grid into the response by itself with the additional header? but it is still in its unchanged html format?

On 2/1/06, Frank Silbermann <[EMAIL PROTECTED]> wrote:

ASP.NET has an easy way to return a DataGrid as a Microsoft Excel file:

Dim stringwriter As New System.IO.StringWriter()
Dim htmlwriter As New System.Web.UI.HtmlTextWriter(stringwriter)

DataGrid1.RenderControl(htmlwriter)
Response.AppendHeader("content-disposition",
"attachment;filename=name.xls")
Response.Write(stringwriter.ToString())
Response.End()

What is nice is that the Excel worksheet reflects the styling of the
DataGrid.  I don't suppose that the DataTable of Wicket Extensions has
anything like this capability.  Is there an easy way to do this?

I've looked at the JExcelAPI and jXLS, but these solutions are much too
low-level for me -- much harder to use than the simple code above.  I
can do without the fancy formatting; I'm willing to settle for code that
simply returns the user a default Excel file whose grid is filled from
an arbitrary two-dimensional array of strings (or list of lists, or
whatever).

What is the simplest solution?

/Frank Silbermann


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new
AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmdlnk&kid3432&bid#0486&dat1642
_______________________________________________
Wicket-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/wicket-user

 

Reply via email to