ASF Bugzilla – Attachment 3310 Details for
Bug 12843
[PATCH] Make POI handle chinese better
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
java file
ExcelParser.java (text/java), 3.55 KB, created by
jubeson
on 2002-10-02 08:16:50 UTC
(
hide
)
Description:
java file
Filename:
MIME Type:
Creator:
jubeson
Created:
2002-10-02 08:16:50 UTC
Size:
3.55 KB
patch
obsolete
>package poitest; >import java.io.IOException; >import java.io.InputStream; > >import java.util.Iterator; >import java.io.FileInputStream; >import org.apache.poi.poifs.filesystem.POIFSFileSystem; >import org.apache.poi.hssf.usermodel.HSSFCell; >import org.apache.poi.hssf.usermodel.HSSFSheet; >import org.apache.poi.hssf.usermodel.HSSFWorkbook; >import org.apache.poi.hssf.usermodel.HSSFRow; >public class ExcelParser { > public HSSFWorkbook wb ; > public HSSFSheet sheet; >public ExcelParser(String _fileName) { > try{ > //String tmp = new String("/usr/local/JRun-31/servers/default/resource-app/Resources/Network/\u7DB2\u8DEF\u5BB9\u91CF\u53CA\u4F7F\u7528\u73FE\u6CC1\u9031\u8868-2-diagram(\u8655\u9577\u6307\u793A).xls".getBytes(),"iso8859-1"); > //System.out.println(tmp); > System.out.println(_fileName); > FileInputStream fis = new FileInputStream(_fileName); > //InputStream input = POIExample.class.getResourceAsStream(_fileName ); > POIFSFileSystem fs = new POIFSFileSystem( fis ); > wb = new HSSFWorkbook(fs); > }//end try > catch(Exception e){ > e.printStackTrace(); > }//end catch > }//end end >void getNewestSheet(){ > String tmp; > int tmpInt=0; > int index = 0; > for(int i=0;i<wb.getNumberOfNames();i++){ > tmp = wb.getSheetName(i); > tmp=tmp.trim(); > try{ > if(Integer.parseInt(tmp)>tmpInt){ > tmpInt=Integer.parseInt(tmp); > index = i; > }//end if > }//end try > catch(java.lang.NumberFormatException nfe){ > continue; > }//end catch > } > sheet = wb.getSheetAt(index); > }//end end >//----------------------------------------------------------------- >public String getNewestDateString(){ > String tmp; > int tmpInt=0; > int index = 0; > for(int i=0;i<wb.getNumberOfNames();i++){ > tmp = wb.getSheetName(i); > tmp=tmp.trim(); > try{ > if(Integer.parseInt(tmp)>tmpInt){ > tmpInt = Integer.parseInt(tmp); > index = i; > }//end if > }//end try > catch(java.lang.NumberFormatException nfe){ > continue; > }//end catch > > } > return wb.getSheetName(index); > }//end end >//------------------------------------------------------------------- > // this function is spicify to NewWork department excel table >public HSSFRow getRowByName(String _name){ > HSSFRow row = null; > HSSFCell cell = null; > Iterator rows = sheet.rowIterator(); > while (rows.hasNext()) { > row = (HSSFRow) rows.next(); > //System.out.println( "Row #" + row.getRowNum() + "-" + row.getFirstCellNum() + "-" + row.getLastCellNum()); > cell = row.getCell((short)1); > if(cell == null) continue; > else { > String item = ""; > item=cell.getStringCellValue() ; > if(item.equals(_name)){ > return row; > }//end if > > }//end else > }//end while > return null; > }//end end >//----------------------------------------------------- > >public HSSFRow getNextRow(HSSFRow _row){ > HSSFRow row = null; > Iterator rows = sheet.rowIterator(); > while (rows.hasNext()) { > row = (HSSFRow) rows.next(); > if(row.equals(_row)){ > return (HSSFRow)rows.next(); > > }//end if > }//end while > return null; > }//end end > }//end end
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 12843
:
3309
| 3310 |
3311
|
3962
|
4098
|
4130