Return-Path: Delivered-To: apmail-poi-user-archive@www.apache.org Received: (qmail 71429 invoked from network); 21 Apr 2010 23:41:30 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 21 Apr 2010 23:41:30 -0000 Received: (qmail 86845 invoked by uid 500); 21 Apr 2010 23:41:30 -0000 Delivered-To: apmail-poi-user-archive@poi.apache.org Received: (qmail 86824 invoked by uid 500); 21 Apr 2010 23:41:30 -0000 Mailing-List: contact user-help@poi.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "POI Users List" Delivered-To: mailing list user@poi.apache.org Received: (qmail 86812 invoked by uid 99); 21 Apr 2010 23:41:30 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Apr 2010 23:41:30 +0000 X-ASF-Spam-Status: No, hits=0.9 required=10.0 tests=RCVD_NUMERIC_HELO,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of jak-poi-user@m.gmane.org designates 80.91.229.12 as permitted sender) Received: from [80.91.229.12] (HELO lo.gmane.org) (80.91.229.12) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 21 Apr 2010 23:41:21 +0000 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1O4jXO-0001jZ-N4 for user@poi.apache.org; Thu, 22 Apr 2010 01:40:58 +0200 Received: from 66.162.85.70 ([66.162.85.70]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 22 Apr 2010 01:40:58 +0200 Received: from ramon by 66.162.85.70 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 22 Apr 2010 01:40:58 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: user@poi.apache.org connect(): No such file or directory From: Ramon F Herrera Subject: Re: Trying to edit a spreadsheet using XSSF Date: Wed, 21 Apr 2010 18:40:50 -0500 Lines: 99 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 66.162.85.70 User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.9) Gecko/20100317 Thunderbird/3.0.4 In-Reply-To: X-Virus-Checked: Checked by ClamAV on apache.org This is the error message: ---------------------------------------------------------- Exception in thread "main" java.lang.NoClassDefFoundError: org/openxmlformats/schemas/spreadsheetml/x2006/main/CTDxfs$1 at org.openxmlformats.schemas.spreadsheetml.x2006.main.CTDxfs.(Unknown Source) at org.openxmlformats.schemas.spreadsheetml.x2006.main.CTDxfs$Factory.newInstance(Unknown Source) at org.apache.poi.xssf.model.StylesTable.writeTo(StylesTable.java:362) at org.apache.poi.xssf.model.StylesTable.commit(StylesTable.java:377) at org.apache.poi.POIXMLDocumentPart.onSave(POIXMLDocumentPart.java:177) at org.apache.poi.POIXMLDocumentPart.onSave(POIXMLDocumentPart.java:181) at org.apache.poi.POIXMLDocument.write(POIXMLDocument.java:214) at org.apache.poi.hssf.usermodel.examples.ReadWriteWorkbook.main(ReadWriteWorkbook.java:41) Caused by: java.lang.ClassNotFoundException: org.openxmlformats.schemas.spreadsheetml.x2006.main.CTDxfs$1 at java.net.URLClassLoader$1.run(URLClassLoader.java:202) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:190) at java.lang.ClassLoader.loadClass(ClassLoader.java:307) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301) at java.lang.ClassLoader.loadClass(ClassLoader.java:248) ... 8 more Java Result: 1 BUILD SUCCESSFUL (total time: 1 second) ---------------------------------------------------------- TIA, -Ramon > > This is the modified version: > > ------------------------------------ > > package org.apache.poi.hssf.usermodel.examples; > > import org.apache.poi.xssf.usermodel.*; > import org.apache.poi.ss.usermodel.*; > > import java.io.FileInputStream; > import java.io.FileOutputStream; > import java.io.IOException; > > /** > * This example demonstrates opening a workbook, modifying > * it and writing the results back out. > * @author Glen Stampoultzis (glens at apache.org) > */ > > public class ReadWriteWorkbook { > > public static void main(String[] args) throws IOException { > > FileInputStream fileIn = null; > FileOutputStream fileOut = null; > XSSFWorkbook wb; > > try { > > fileIn = new FileInputStream("1-Tab.xlsx"); > wb = new XSSFWorkbook(fileIn); > Sheet sheet = wb.getSheetAt(0); > Row row = sheet.getRow(2); > if (row == null) > row = sheet.createRow(2); > Cell cell = row.getCell(3); > if (cell == null) > cell = row.createCell(3); > cell.setCellType(XSSFCell.CELL_TYPE_STRING); > cell.setCellValue("a test"); > > // Write the output to a file > fileOut = new FileOutputStream("workbookout.xlsx"); > wb.write(fileOut); // Crashes here, creating an empty file > > } finally { > if (fileOut != null) > fileOut.close(); > if (fileIn != null) > fileIn.close(); > } > } > } --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@poi.apache.org For additional commands, e-mail: user-help@poi.apache.org