Return-Path: Delivered-To: apmail-jakarta-poi-user-archive@www.apache.org Received: (qmail 88872 invoked from network); 10 Jun 2005 15:38:29 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 10 Jun 2005 15:38:29 -0000 Received: (qmail 92374 invoked by uid 500); 10 Jun 2005 15:38:25 -0000 Delivered-To: apmail-jakarta-poi-user-archive@jakarta.apache.org Received: (qmail 92269 invoked by uid 500); 10 Jun 2005 15:38:24 -0000 Mailing-List: contact poi-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "POI Users List" Reply-To: "POI Users List" Delivered-To: mailing list poi-user@jakarta.apache.org Received: (qmail 92218 invoked by uid 99); 10 Jun 2005 15:38:23 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: neutral (hermes.apache.org: local policy) Received: from email06.consolidated.net (HELO email06.consolidated.net) (216.176.95.177) by apache.org (qpsmtpd/0.28) with ESMTP; Fri, 10 Jun 2005 08:38:20 -0700 Received: from mtnsmtp02.consolidated.com (email2.consolidated.com [216.176.95.7]) by email06.consolidated.net (MOS 3.5.8-GR) with SMTP id COL86362; Fri, 10 Jun 2005 10:37:46 -0500 (CDT) Received: from [10.1.20.45] ([10.1.20.45]) by mtnsmtp02.consolidated.com (Lotus Domino Release 6.5.1) with ESMTP id 2005061010374478-1764188 ; Fri, 10 Jun 2005 10:37:44 -0500 Message-ID: <42A9B3C8.707@webdesignteks.com> Date: Fri, 10 Jun 2005 10:37:44 -0500 From: James Chaney User-Agent: Mozilla Thunderbird 1.0.2 (Windows/20050317) X-Accept-Language: en-us, en MIME-Version: 1.0 To: POI Users List Subject: Re: HSSF class not found errors References: <42A98B8A.5030704@webdesignteks.com> In-Reply-To: X-MIMETrack: Itemize by SMTP Server on mtnsmtp02/consolidated(Release 6.5.1|January 21, 2004) at 06/10/2005 10:37:44 AM, Serialize by Router on mtnsmtp02/consolidated(Release 6.5.1|January 21, 2004) at 06/10/2005 10:37:46 AM, Serialize complete at 06/10/2005 10:37:46 AM Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=ISO-8859-1; format=flowed X-Virus-Checked: Checked X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N Neither - but if I take the "package" off then I get even more errors. All I want to do is to juts be able to create an Excel spreadsheet through a servlet - I have been able to do it with a JSP page but need to be able to connect to an Oracle database and pull records from there and them insert them into the XLS file. I have the db connection part working fine and I have iText working fine to create the PDF part of the application but for some reason I can not get HSSF to cooperate :( R S wrote: >Are you sure you want to package your java file (WriteExcel) in the >"org.apache.poi.hssf.usermodel" package? Is your code in the >"org/apache/poi/hssf/usermodel" directory? > >I hate to come off as a jerk, but it would be in your best interests >to review java packaging. > >RS > > > >On 6/10/05, James Chaney wrote: > > >>Question on setting up POI to use HSSF - I have downloaded >>poi-2.5.1-final-20040804 and added it to my ClassPath variable. I then >>create a java file with the following: >> >>package org.apache.poi.hssf.usermodel; >>import org.apache.poi.hssf.usermodel.HSSFWorkbook; >>.......... >> >>And when I try to compile it I get the following errors: >> cannot resolve symbol >> class HSSFWorbook >> package usermodel >> import org.apache.poi.poifs.filesystem.HSSFWorbook; (I get the same >>error for all the imports org.apache.poi.hssf.usermodel.* - just listed >>the one) >> >>If I remove the package and import statements the rest of my java code >>compiiles just fine. Can you please tell me what I may be doing wrong? I >>have explained the top part in short in recommendation from the jakarta >>site - here is my actual code: >> >>package org.apache.poi.hssf.usermodel; >> >>import java.io.FileInputStream; >>import java.io.FileOutputStream; >> >>import org.apache.poi.hssf.usermodel.HSSFCell; >>import org.apache.poi.hssf.usermodel.HSSFRow; >>import org.apache.poi.hssf.usermodel.HSSFSheet; >>import org.apache.poi.hssf.usermodel.HSSFWorkbook; >>import org.apache.poi.poifs.filesystem.POIFSFileSystem; >> >>public class WriteExcel >>{ >> private static String filename = "C:\\temp\\sales.xls"; >> public static void main(String[] args) >> { >> try >> { >> System.out.println( >> "Demonstration of programmatic manipulation of " + >> "Microsoft Excel Spreadsheet via the Apache POI API."); >> // open the Excel Spreadsheet >> POIFSFileSystem fs = >> new POIFSFileSystem(new FileInputStream(filename)); >> HSSFWorkbook hssfworkbook = new HSSFWorkbook(fs); >> // grab the first sheet >> HSSFSheet sheet = hssfworkbook.getSheetAt(0); >> // grab the appropriate cell we want to manipulate >> // cell B2 maps to Row 1, Column 1 >> HSSFRow row = sheet.getRow(1); >> HSSFCell cell = row.getCell((short)1); >> // if the cell we want is not created, create >>it if (cell == null) >> cell = row.createCell((short)1); >> // set the cell type. In this case, our cell is numeric >> cell.setCellType(HSSFCell.CELL_TYPE_NUMERIC); >> // set the cell's value >> cell.setCellValue(89000.00); >> // Write the output to a file >> FileOutputStream fileOut = new FileOutputStream(filename); >> hssfworkbook.write(fileOut); >> // Close the file >> fileOut.close(); >> } >> catch(Exception e) >> { e.printStackTrace(); >> } >> } >>} >> >> >>--------------------------------------------------------------------- >>To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org >>Mailing List: http://jakarta.apache.org/site/mail2.html#poi >>The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ >> >> >> >> > >--------------------------------------------------------------------- >To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org >Mailing List: http://jakarta.apache.org/site/mail2.html#poi >The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/ > > > > > > --------------------------------------------------------------------- To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org Mailing List: http://jakarta.apache.org/site/mail2.html#poi The Apache Jakarta Poi Project: http://jakarta.apache.org/poi/