Apache POI Locking Header Rows

后端 未结 3 1995
無奈伤痛
無奈伤痛 2021-01-31 13:26

Is anyone out there familiar with a way to lock a row in a spreadsheet created with Apache POI 3.7? By locking I mean that I want the title row for the columns to remain visible

3条回答
  •  花落未央
    2021-01-31 13:43

    In case you need to Freeze any particular row anywhere in the sheet you can use (Within org.apache.poi.ss.usermodel.Sheet) (Available in POI 3.7 as well)

    Sheet.createFreezePane(int colSplit, int rowSplit, int leftmostColumn, int topRow)
    

    In your case if you want to freeze just your first x rows then the int leftmostColumn, int topRow section will get removed and you can use just

    Sheet.createFreezePane(int colSplit, int rowSplit)
    

    for example

    sheet1.createFreezePane(0, 5); // this will freeze first five rows
    

提交回复
热议问题