简体   繁体   中英

Header is not created in Excel using Apache POI Java

I wrote code the below to create a header in the excel file. But the header is always giving empty. Can you please correct me, if am wrong in the code.

XSSFRow row=spreadsheet.createRow(1);
              XSSFCell cell;

              cell=row.createCell(1);
              cell.setCellValue("ID");
              cell=row.createCell(2);
              cell.setCellValue("area_info_id");

Use the header related function to set your header.

Header header = spreadsheet.getHeader();
header.setLeft("Left");
header.setCenter("Center");
header.setRight("Right");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM