Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/excel/26.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache Excel工作表移动的行数不超过有限的行数_Apache_Excel_Apache Poi - Fatal编程技术网

Apache Excel工作表移动的行数不超过有限的行数

Apache Excel工作表移动的行数不超过有限的行数,apache,excel,apache-poi,Apache,Excel,Apache Poi,我在“sheet”变量中有一个excel模板。我需要将数据库值添加到新行中,如图所示。我使用ApachePOI中的函数来编辑excel文件 sheet.shiftRows(RowId, sheet.getLastRowNum(), Rows); 但添加的行数不超过16行。起初,页面高度似乎是1,因此不能超过一页,但即使使用 sheet.getPrintSetup().setFitHeight((short)9); 同样的错误也来了。知道为什么会这样吗 shiftRows函数的参数是15、25

我在“sheet”变量中有一个excel模板。我需要将数据库值添加到新行中,如图所示。我使用ApachePOI中的函数来编辑excel文件

sheet.shiftRows(RowId, sheet.getLastRowNum(), Rows);
但添加的行数不超过16行。起初,页面高度似乎是1,因此不能超过一页,但即使使用

sheet.getPrintSetup().setFitHeight((short)9);
同样的错误也来了。知道为什么会这样吗


shiftRows函数的参数是15、25、12

谢谢。我发现错误是因为25行之后有空行。所以我创建了新行。
   HSSFPrintSetup printSetup = sheet.getPrintSetup();
    sheet.getPrintSetup().setFitWidth((short) 1);
    sheet.getPrintSetup().setFitHeight((short) 0);
    sheet.setAutobreaks(true);
    printSetup.setLandscape(true);