简体   繁体   English

从特定列开始表excel apache poi

[英]Start the table from a specific column excel apache poi

I'm having a problem in excel while using Apache POI. 使用Apache POI时,我在excel中遇到问题。 I can create rows, but sometimes I'm in a situation where I would like to start from a particular column only. 我可以创建行,但是有时候我只想从特定的列开始。

So is it possible to start any particular column like the 'C' column Instead of the column 'A' Always. 因此可以启动任何特定的列,例如“ C”列,而不是“ A”列。

I'm using the Java language for this. 我为此使用Java语言。

Sheet sheet = workbook.createSheet("Sheet 1");
  Row header = sheet.createRow(0);
  header.createCell(0).setCellValue("Header 1");

Click here to see image of excel file 点击这里查看Excel文件的图像

Looks like you provide the number of column as a parameter and in your case this is column #0. 看起来您提供了列数作为参数,在您的情况下,这是列#0。 If you would like to work with third column just change the number of column: header.createCell(2).setCellValue("Header 1"); 如果您想使用第三列,只需更改列数即可: header.createCell(2).setCellValue("Header 1");

More about usage of this method you can read in javadoc here . 更多关于这种方法的使用,您可以在阅读的javadoc 这里

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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