poi-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nileshkhavat <nileshkha...@yahoo.co.in>
Subject Re: How to update cell(s) in excel files ?
Date Sat, 04 Oct 2008 07:28:04 GMT

Hi,

I have also used objects in the sheet.


nileshkhavat wrote:
> 
> ------------------------------------------------------------------------------------
> Hi,
> 
> I have a excel file with many sheets in it.
> It has various formulas, colors and dropdowns in it.
> Colors and dropdowns are populated by VB MACROS. 
> I have tried to update a cell in it by code.
> 
>             POIFSFileSystem fs = new POIFSFileSystem(new
> FileInputStream("c:\\Try.xls"));
>             HSSFWorkbook wb = new HSSFWorkbook(fs);
>             HSSFSheet sheet = wb.getSheet("Try Sheet");
>             HSSFRow row = sheet.getRow(3);
>             HSSFCell cell = row.getCell((short) 2);
> 
>             if (cell == null) {
>                 cell = row.createCell((short) 2);
>             }
>             
>             cell.setCellType(HSSFCell.CELL_TYPE_STRING);
>             HSSFRichTextString str = new HSSFRichTextString("My Project
> Name");
>             cell.setCellValue(str);
> 
>             FileOutputStream fileOut = new
> FileOutputStream("c:\\Try.xls");
>             wb.write(fileOut);
>             fileOut.close(); 
> 
> 
> After executing above code following happens
>    -excel file gets damaged.
>    -it shows only text contents in sheet.
>    -all colors, dropdowns disapears in sheet.
>    -some sheets totally absent.
> 
> Please suggest me the solution over it.
> 
> ------------------------------------------------------------------------------------

> 

-- 
View this message in context: http://www.nabble.com/How-to-update-cell%28s%29-in-excel-files---tp19738477p19809753.html
Sent from the POI - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org


Mime
View raw message