Poi operation Excel Style
Package COM. cloud. poi. utils; import Java. io. file; import Java. io. fileoutputstream; import Java. io. ioexception; import Java. io. outputstream; import Org. apache. poi. SS. usermodel. cell; import Org. apache. poi. SS. usermodel. cellstyle; import Org. apache. poi. SS. usermodel. row; import Org. apache. poi. SS. usermodel. sheet; import Org. apache. poi. SS. usermodel. workbook; import Org. apache. poi. xssf. usermodel. xssfcell; import Org. Apache. poi. xssf. usermodel. xssffont; import Org. apache. poi. xssf. usermodel. xssfworkbook;/*** poi operation Excel Style * @ author Henry */public class poiexcelstylealter {public static void main (string [] ARGs) throws ioexception {string filepath = "D: /"; string filename =" test "; string filetype =" XLSX "; workbook = new xssfworkbook (); // create a workbook sheet = workbook. createsheet ("test"); // create a sheetsheet. setcolu Mnhidden (2, true); // hide the 1st columns. The column "row" = "sheet" is not displayed in Excel. createrow (1); cell = row. createcell (1); cellstyle style = workbook. createcellstyle (); // create a style object style. setwraptext (true); // set Automatic newline xssffont font = (xssffont) workbook. createfont (); // create the font object. setfontname (""); style. setfont (font); cell. setcellstyle (style); style. setlocked (true); // sets whether the style referenced by the cell locks the cell. setcelltype (xssfcell. cell_type_string); // set the ticket Cell. setcellvalue ("test I'm tired now, you know, I'm really tired. I am very tired and tired !~ I tiger you! "); File = new file (filepath + filename + ". "+ filetype); outputstream stream = new fileoutputstream (File); workbook. write (Stream); stream. close ();}}