there isnt anything called 2.0 yet.. its either 2.0pre1 or 2.0pre2 or 2.0pre3 .. every build that is available for download has a version and timestamp in it.
In general, you problem should be solved by using the latest code from CVS, or waiting for the next release. On Mon, 2003-10-27 at 10:45, Majumdar, Sanjib (CORP, GEITC, Contractor) wrote: > Avik, > I am using 2.0 version of POI. > Sanjib > > -----Original Message----- > From: Avik Sengupta [mailto:[EMAIL PROTECTED] > Sent: Thursday, October 23, 2003 8:40 PM > To: POI Users List > Subject: Re: Writing to Excel file using POI > > > Sanjib, there isnt much use of sending code that no-one can run. If you > can extract a testcase that can be run independently, by anyone, then it > becomes possible to debug. If we were able to find problems by looking > at code, there wouldnt be any bugs in POI :) > > > Which version of POI are you using? > > > On Thu, 2003-10-23 at 20:34, Majumdar, Sanjib (CORP, GEITC, Contractor) > wrote: > > > > Hi, > > > > I am trying to input some data in a template Excel file. > > While reading the file I am not getting any problem but the file is getting > > corrupted and unable to open after I am trying to write some data inside that. > > > > My question, is it possible to write some rows of data in a pre-defined Excel > > file ? > > > > I am sending my Program. > > > > It will be great benifitial if I get any good suggestion to implement > > sucessfully. > > > > Sanjib > > > > > > import org.apache.poi.hssf.usermodel.*; > > > > import java.io.FileInputStream; > > import java.io.FileOutputStream; > > import java.io.IOException; > > import java.io.File; > > > > import java.util.ResourceBundle; > > import java.util.Properties; > > import java.util.Iterator; > > > > import report.PLUtil; > > > > > > public class TestExcel > > { > > HSSFWorkbook wb; > > HSSFSheet sheet; > > > > int totRows = 65; > > HSSFRow rows[] = new HSSFRow[totRows]; > > > > //**************************************************************** > > private static final String fileDir = PLUtil.FILE_DIR; > > private static final String fileContext = PLUtil.FILE_CONTEXT; > > private static final String fileLocn = PLUtil.REPORT_FILE_DIR; > > private static final String filePath = fileDir + fileContext + fileLocn; > > //**************************************************************** > > private static final String prop_class = "config"; > > private static final ResourceBundle oProp = > > ResourceBundle.getBundle(prop_class); > > private static final Properties props = System.getProperties(); > > //**************************************************************** > > > > > > TestExcel() { > > try { > > String file = "Template1.xls"; > > FileInputStream fileIn = null; > > fileIn = new FileInputStream(filePath + "/" + file); > > wb = new HSSFWorkbook(fileIn); > > fileIn.close(); > > } catch(Exception ex) { > > System.err.println("Error in Constructor :: " + ex); > > } > > } > > > > public static void main(String[] args) { > > System.out.println("Processing ..."); > > new TestExcel().readExcelData(null); > > System.out.println("Done !!"); > > } > > > > public void readExcelData(ArrayList list) { > > sheet = wb.getSheet("COMP CARD"); > > > > drawData(); > > writeExcelFile(wb, filePath); > > > > } > > > > private void writeExcelFile(HSSFWorkbook wb, String dirName) > > { > > try { > > System.out.println("Reading the Excel File..."); > > String file = "Template1.xls"; > > FileOutputStream fileOut = null; > > fileOut = new FileOutputStream(dirName + "/" + file); > > wb.write(fileOut); > > fileOut.close(); > > System.out.println("Excel File has been read"); > > } catch (IOException ioe) { > > System.err.println("Test::writeExcelFile : " + ioe); > > } > > } > > > > private HSSFRow[] getRows(int howmany) { > > for (int i = 0; i < howmany; ++i) { > > rows[i] = sheet.getRow(i); > > } > > return rows; > > } > > private HSSFCell printData(int rowno, int startCellno, String data) { > > HSSFCell cell = rows[rowno].getCell((short) startCellno); > > cell.setCellValue(data); > > return cell; > > } > > > > private void drawData() { > > System.out.println("Writing Data..."); > > rows = getRows((short)10); > > HSSFCell cell; > > cell = printData(7, 0, "Testing"); > > > > } > > > > } > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
