At 9:59 PM -0500 2/3/03, Andrew C. Oliver wrote:
Done (#16767). Below is a copy of what I submitted (sans file attachments), in case anyone spots an obvious error in what I was doing.can you attach to a bug (see the get involved page):1. The most simple code which replicates the issue.(executable) 2. The output from that, attached. 3. A hand-produced sheet which is the output you expect
--Andy
==========
The code below generates a 1-cell spreadsheet. When I open it, the "12345" is left-justified, like I would expect a string value to be. But if I double-click the cell and then click out of it without making any changes, it becomes the integer 12345.
If I were creating the spreadsheet by hand I would have entered '12345 to force the value to be a string, and the apostrophe would be there when I double-click the cell.
--Andy
==========
import org.apache.poi.hssf.usermodel.*;
import java.io.*;
public class Test
{
public static void main(String[] args)
{
try
{
doMain();
}
catch (Exception e)
{
e.printStackTrace();
}
}
private static void doMain() throws Exception
{
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet("test");
HSSFRow row = sheet.createRow((short)0);
HSSFCell cell = row.createCell((short)0);
cell.setCellType(HSSFCell.CELL_TYPE_STRING);
cell.setCellValue("12345");
FileOutputStream fos = new FileOutputStream("/tmp/test.xls");
wb.write(fos);
fos.flush();
fos.close();
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
