Danny,
Thank you so much for helping me with this issue. (I was beginning to feel
a little helpless.) I think I'm having email issues over here so please
reply to acknowledge that this last email goes through. This is about my
3rd time sending it into the users list and I don't think it went through
once. My simple example is below.
An example...
I create a new excel workbook named Template2.xls in my root (C) drive
using Excel 2000 on Win2K.
In Sheet1 I change the value of cell A:1 to "My Template".
I save this to my C drive.
I run the following program and the Sheet2 in Results.xls is not updated.
What gives?
package com.craig.JAS;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
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;
/**
* @author craic0ld
* Created Jun 17, 2003
*
* Purpose:
*
*/
public class ExcelTest
{
public static void main(String[] args)
{
try
{
String xlFile = "C:\\Template2.xls";
POIFSFileSystem fs = new POIFSFileSystem(new
FileInputStream(xlFile));
HSSFWorkbook wkbk = new HSSFWorkbook(fs);
HSSFSheet sheet = wkbk.getSheet("Sheet2");
HSSFRow row = sheet.createRow(1);
HSSFCell cell = row.createCell((short)1);
cell.setCellValue("Hello World!");
FileOutputStream fo = new FileOutputStream("C:
\\Results.xls");
wkbk.write(fo);
fo.close();
System.out.println("Done!");
} catch (Exception e)
{
System.out.println(e.getMessage());
e.printStackTrace();
}
}
}
If I change it to write to Sheet1 then it works fine.
Danny Mui
<[EMAIL PROTECTED] To: POI Users List <[EMAIL
PROTECTED]>
m> cc:
Subject: Re: Cannot write to extra
sheets
06/18/2003 01:58
PM
Please respond to
"POI Users List"
Hi Craig,
I'm sorry I can't grok (I borrowed that term ;) your source code too
quickly. Would it be possible for you to set up a test case to have the
minimal code necessary to reproduce your problem? Basically, I want to
be be able to cut/paste/run and look at the results.
I should have said that straight up, shouldn't I?
danny
[EMAIL PROTECTED] wrote:
>Danny,
>
>I will include as much as possible while being as bandwidth friendly as
>possible.
>
>
>
>
>
---------------------------------------------------------------------
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]