How about we just stick with nice open formats instead of trying to co-opt a crappy MS owned one? text/csv works great, and there are open XML based formats as well. Now if this is a case of I NEED Excel, fine. I have found that Excel is one of those few programs that does it's job so well, that text/csv is usually not a problem at all, and it lets everyone else read and manipulate data as well.
Bob Prah wrote: > Hi Lucas, > > Have a look at the excerpt below which I received about two days ago. > It might help solve your problem : > > > <!-- Begin Quote --> > > CREATE EXCEL-FORMATTED DATA > > Until recently, the most common way to create a Microsoft Excel file in > a Java application was to create a comma separated values (CSV) file in a > servlet or JSP and return it to the browser as MIME-type, text/csv. The > browser would then call Excel and the CSV would be displayed. > > There is now a project that provides Java developers with a real tool > for creating Excel files. It's the most mature part of a new Jakarta > project named Poor Obfuscation Implementation (POI). The Excel > component of POI > is named Horrible Spreadsheet Format (HSSF). > > While HSSF provides many different ways of interacting with the engine, > the one we'll focus on is the easy high-level user API. > > Here's a simple example that creates a matrix of values in an Excel > sheet: > > import org.apache.poi.hssf.usermodel.*; > import java.io.FileOutputStream; > > // code run against the jakarta-poi-1.5.0-FINAL-20020506.jar. > public class PoiTest { > > static public void main(String[] args) throws Exception { > FileOutputStream fos = new FileOutputStream("foo.xls"); > HSSFWorkbook wb = new HSSFWorkbook(); > HSSFSheet s = wb.createSheet(); > wb.setSheetName(0, "Matrix"); > for(short i=0; i<50; i++) { > HSSFRow row = s.createRow(i); > > for(short j=0; j<50; j++) { > HSSFCell cell = row.createCell(j); > cell.setCellValue(""+i+","+j); > } > } > wb.write(fos); > fos.close(); > } > } > > This code first creates a workbook, gets a single sheet from that > workbook, names it, and then proceeds to write a 50x50 matrix on it. This > outputs an Excel file named foo.xls, which even opens on an Apple Mac. > > The POI project is an exciting new step for Java, bringing Windows > document integration to a new audience and allowing Java > developers to improve > the functionality of their products. > > > <!-- End Quote --> > > > Further info. can be found at : > > http://jakarta.apache.org/poi/hssf/ > > > Bob ___________________________________________________________________________ To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff SERVLET-INTEREST". Archives: http://archives.java.sun.com/archives/servlet-interest.html Resources: http://java.sun.com/products/servlet/external-resources.html LISTSERV Help: http://www.lsoft.com/manuals/user/user.html