Excel API - Poi Chinese garbled solution

xiaoxiao2021-03-06  39

// Write List ExpItems to the Excel file

FileOutputStream Fileout = New FileoutputStream (FilePath);

HSSFWORKBOOK WB = New HSSFWORKBOOK (); // HSSFWORKBOOK

HSSFSHEET Sheet = wb.createsheet (); //

Wb.setsheetname (0, "Experiment item list - Chinese test", hssfworkbook.encoding_utf_16);

HSSFrow Row = Sheet.createrow ((Short) 0);

HSSFCell Cell;

ITerator it = ExpItems.ITerator ();

INT i = 0;

While (ore.hasnext ()) {

Cell = row.createcell ((Short) i);

Cell.setencoding (hssfcell.encoding_utf_16);

Cell.setcellValue (iter.next (). TOString ());

i ;

}

Wb.write (fileout);

Fileout.close ();

}

转载请注明原文地址:https://www.9cbs.com/read-60119.html

New Post(0)