"Web development" ☆★ Using POI Operations Excel Table Series tutorial "11" Cell merge
Package Csg.xiaoye.poidemo;import Java.io.fileoutputstream;import Org.apache.poi.hssf.usermodel.HSSFWorkbook; Import Org.apache.poi.ss.usermodel.cell;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.ss.util.cellrangeaddress;public class Poispacemer {public static void main (string[] args) throws Except ion{Workbook wb=new Hssfworkbook ();//define a new workbook Sheet sheet=wb.createsheet ("First Sheet page"); Create the first sheet page of Row row=sheet.createrow (1); Create a row of Cell Cell=row.createcell (1); Cell.setcellvalue ("Cell merge Test"); Sheet.addmergedregion (New cellrangeaddress (1,//Start line 2,//End Line 1,//actually column 2//End column)); FileOutputStream fileout=new fileoutputstream ("d:\\ saya. xls"); Wb.write (FileouT); Fileout.close (); }}
The effect is as follows:
650) this.width=650; "src=" http://s3.51cto.com/wyfs02/M02/26/90/wKioL1Nrg4CCosNmAAA5Qus7ZeE858.jpg "title=" 1.png " alt= "Wkiol1nrg4ccosnmaaa5qus7zee858.jpg"/>
This article from "Promise always attached to the small wood 、、、" blog, please be sure to keep this source http://1936625305.blog.51cto.com/6410597/1408597