You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@poi.apache.org by Dave Coventry <dg...@gmail.com> on 2009/12/30 08:53:38 UTC
Invalid Character in sheet name
I'm getting the following error:
Exception in thread "main" java.lang.IllegalArgumentException: Invalid
char (/) found at index (0) in sheet name '/tmp/myexcel.xls'
at org.apache.poi.hssf.record.BoundSheetRecord.validateSheetName(BoundSheetRecord.java:118)
at org.apache.poi.hssf.record.BoundSheetRecord.setSheetname(BoundSheetRecord.java:91)
at org.apache.poi.hssf.model.Workbook.setSheetName(Workbook.java:551)
at org.apache.poi.hssf.usermodel.HSSFWorkbook.createSheet(HSSFWorkbook.java:754)
at emp.Main.main(Main.java:198)
The code is as follows:
wb=new HSSFWorkbook(FileInputStream(args[0]));
sheet = wb.getSheet("ERP");
for(Row row : sheet){
rowindex=row.getRowNum();
for(Cell cell : row){
cellindex=cell.getColumnIndex();
String cellStringValue="";
double cellNumericValue=0;
if(cell.getCellType()==Cell.CELL_TYPE_STRING){
cellStringValue=cell.getStringCellValue();
}
else if (cell.getCellType()==Cell.CELL_TYPE_NUMERIC){
cellNumericValue=cell.getNumericCellValue();
}
if((headerRow==0) || (headerRow==rowindex)){
if(cell.getCellType()==Cell.CELL_TYPE_STRING){
if(checkCellforValue(cellStringValue,"Initiatives")){
description=cell.getColumnIndex();
headerRow=rowindex;
}
}
}
else{
if (cellindex==description){
descriptionValue=cellStringValue;
}
}
}
}
} catch (Exception e) {
System.out.println("Workbook initialisation Failed!");
e.printStackTrace();
return;
}
I'm using 3.6.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org
Re: Invalid Character in sheet name
Posted by Dave Coventry <dg...@gmail.com>.
Really sorry to bother you all; please disregard this request for help.
I noticed the last exception is on line emp.Main.main(Main.java:198),
which contained a typo. (not included in the code I posted).
Sorry again,
Dave
2009/12/30 Dave Coventry <dg...@gmail.com>:
> I'm getting the following error:
>
> Exception in thread "main" java.lang.IllegalArgumentException: Invalid
> char (/) found at index (0) in sheet name '/tmp/myexcel.xls'
> at org.apache.poi.hssf.record.BoundSheetRecord.validateSheetName(BoundSheetRecord.java:118)
> at org.apache.poi.hssf.record.BoundSheetRecord.setSheetname(BoundSheetRecord.java:91)
> at org.apache.poi.hssf.model.Workbook.setSheetName(Workbook.java:551)
> at org.apache.poi.hssf.usermodel.HSSFWorkbook.createSheet(HSSFWorkbook.java:754)
> at emp.Main.main(Main.java:198)
>
> The code is as follows:
>
>
> wb=new HSSFWorkbook(FileInputStream(args[0]));
> sheet = wb.getSheet("ERP");
> for(Row row : sheet){
> rowindex=row.getRowNum();
> for(Cell cell : row){
> cellindex=cell.getColumnIndex();
> String cellStringValue="";
> double cellNumericValue=0;
> if(cell.getCellType()==Cell.CELL_TYPE_STRING){
> cellStringValue=cell.getStringCellValue();
> }
> else if (cell.getCellType()==Cell.CELL_TYPE_NUMERIC){
> cellNumericValue=cell.getNumericCellValue();
> }
> if((headerRow==0) || (headerRow==rowindex)){
> if(cell.getCellType()==Cell.CELL_TYPE_STRING){
>
> if(checkCellforValue(cellStringValue,"Initiatives")){
> description=cell.getColumnIndex();
> headerRow=rowindex;
> }
> }
> }
> else{
> if (cellindex==description){
> descriptionValue=cellStringValue;
> }
> }
> }
> }
> } catch (Exception e) {
> System.out.println("Workbook initialisation Failed!");
> e.printStackTrace();
> return;
> }
>
> I'm using 3.6.
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@poi.apache.org
For additional commands, e-mail: user-help@poi.apache.org