Package com. csland. workflow. business;
Import org. Apache. Poi. hssf. usermodel. hssfworkbook;
Import org. Apache. Poi. hssf. usermodel. hssfsheet;
Import org. Apache. Poi. hssf. usermodel. hssfrow;
Import org. Apache. Poi. hssf. usermodel. hssfcell;
Import org. Apache. Poi. hssf. usermodel .*;
Import java. Io. fileoutputstream;
Public class ylexcel {
Public ylexcel (){
}
Private Static void createcelltitle (hssfworkbook WB, hssfrow row, int column,
String Value ){
Hssfcell cell = row. createcell (short) column );
Hssfcellstyle cellstyle = WB. createcellstyle ();
Cellstyle. setalignment (hssfcellstyle. align_center );
Hssffont font = WB. createfont ();
Font. setfontheightinpoints (short) 11 );;
Font. setfontname (" ");
Font. setboldweight (hssffont. boldweight_bold );
Cellstyle. setfont (font );
Cell. setcellstyle (cellstyle );
Cell. setcellvalue (value );
}
Private Static void createfile (string outputfile ){
Try {
// Create a new XL document
Hssfworkbook WB = new hssfworkbook ();
// Make a worksheet in the XL document created
Hssfsheet sheet = WB. createsheet ();
// Create row at index zero (top row)
Hssfrow ROW = sheet. createrow (short) 0 );
For (INT I = 0; I <10; I ++ ){
Createcelltitle (WB, row, I, "gisoracle" + I );
}
// The output file is where the XLS will be created
Fileoutputstream fout = new fileoutputstream (outputfile );
// Write the XL Sheet
WB. Write (fout );
Fout. Flush ();
// Done deal ..
Fout. Close ();
System. Out. println ("File Created ..");
}
Catch (exception e ){
System. Out. println ("!! Bang !! Xlcreate (): "+ E );
}
}
Public static void ylb (string ym ){
System. Out. println ("Poi ");
Createfile ("C:/test.xls ");
System. Out. println ("================ ");
}
}