相关疑难解决方法(0)

将值从上面的行返回到当前行

我想做一件简单的事情:我只需要将一些单元格设置为前一行的值.我试过=A(Row()-1)但它不起作用.

excel excel-formula

34
推荐指数
3
解决办法
13万
查看次数

使用Java Apache POI在Excel中插入行

我正在开发与Excel工作表相关的桌面应用程序,所以我在两行之间插入行时遇到了一些问题,是否有可能在使用Apache POI的 java中执行此操作

Workbook wb3=WorkbookFactory.create(new FileInputStream("Book1.xls"));
Sheet sh=wb3.getSheet("sheet1");
Run Code Online (Sandbox Code Playgroud)

//Reading the available rows using (sh.getRow(1))

//Here i need to insert second row (????)

//I have third row here which is already exist (sh.getRow(3))

java excel apache-poi

14
推荐指数
1
解决办法
5万
查看次数

java apache poi shifting Rows遇到运行时异常

我有一个简单的excel表,其中包含基本的excel公式,例如sums,以及从另一个单元格中检索值.现在,我想基本上在两个现有行之间插入一个空行(我已经看过如何在现有excel中使用HSSF(Apache POI)在两行之间插入一行,但我遇到了一些奇怪的问题错误).

所以我尝试通过这样做来移动行:

worksheet.shiftRows(15,16,2);
Run Code Online (Sandbox Code Playgroud)

而我得到的回报是:

Exception in thread "main" java.lang.RuntimeException: not implemented yet
    at org.apache.poi.xssf.usermodel.XSSFEvaluationWorkbook.getExternalSheetIndex(XSSFEvaluationWorkbook.java:127)
    at org.apache.poi.ss.formula.FormulaParser.createAreaRefParseNode(FormulaParser.java:615)
    at org.apache.poi.ss.formula.FormulaParser.parseRangeable(FormulaParser.java:462)
    at org.apache.poi.ss.formula.FormulaParser.parseRangeExpression(FormulaParser.java:268)
    at org.apache.poi.ss.formula.FormulaParser.parseSimpleFactor(FormulaParser.java:1119)
    at org.apache.poi.ss.formula.FormulaParser.percentFactor(FormulaParser.java:1079)
    at org.apache.poi.ss.formula.FormulaParser.powerFactor(FormulaParser.java:1066)
    at org.apache.poi.ss.formula.FormulaParser.Term(FormulaParser.java:1426)
    at org.apache.poi.ss.formula.FormulaParser.additiveExpression(FormulaParser.java:1526)
    at org.apache.poi.ss.formula.FormulaParser.concatExpression(FormulaParser.java:1510)
    at org.apache.poi.ss.formula.FormulaParser.comparisonExpression(FormulaParser.java:1467)
    at org.apache.poi.ss.formula.FormulaParser.unionExpression(FormulaParser.java:1447)
    at org.apache.poi.ss.formula.FormulaParser.parse(FormulaParser.java:1568)
    at org.apache.poi.ss.formula.FormulaParser.parse(FormulaParser.java:176)
    at org.apache.poi.xssf.usermodel.helpers.XSSFRowShifter.updateNamedRanges(XSSFRowShifter.java:116)
    at org.apache.poi.xssf.usermodel.XSSFSheet.shiftRows(XSSFSheet.java:2363)
    at org.apache.poi.xssf.usermodel.XSSFSheet.shiftRows(XSSFSheet.java:2306)
    at com.shel.myProgram.workbook.copyAndInsert(workbook.java:120)
    at com.shel.myProgram.workbook.test(workbook.java:111)
    at com.shel.myProgram.driver.main(driver.java:24)
Run Code Online (Sandbox Code Playgroud)

编辑:

我正在使用这种依赖:

    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-ooxml</artifactId>
        <version>3.9</version>
    </dependency>
Run Code Online (Sandbox Code Playgroud)

java excel apache-poi

5
推荐指数
1
解决办法
2166
查看次数

在apache poi中使用HSSFClientAnchor创建单元格注释

有人可以在创建单元格注释时向我解释如何正确使用Anchors吗?我的工作正在进行,但电子表格发生了变化,我在查看单元格注释时出现问题.这是我使用的代码:

 Comment c = drawing.createCellComment (new HSSFClientAnchor(0, 0, 0, 0, (short)4, 2, (short)6, 5));
Run Code Online (Sandbox Code Playgroud)

这主要是通过试验来找到的.看看它的api并没有让它更清楚.

根据快速入门指南,我也试过以下没有运气:

ClientAnchor anchor = chf.createClientAnchor();
Comment c = drawing.createCellComment(anchor);
c.setString(chf.createRichTextString(message)); 
Run Code Online (Sandbox Code Playgroud)

java apache-poi

3
推荐指数
1
解决办法
8886
查看次数

如何通过搜索单元格文本获得excel列索引?

我有一个excel文件,其中包含标题行和许多列.在第1行中,第10列i的单元格值为"请求".我需要通过搜索值"请求"来获取此单元格索引.有没有任何方法没有迭代列(不使用for循环).

excel

2
推荐指数
1
解决办法
5万
查看次数

Apache POI 换行

我需要一种在预先存在的行之间插入新单元格和/或行而不删除任何行的方法。

我尝试使用:

public static void addRow(File f, int amount, int currentRow)
        throws Exception {
    FileInputStream file = new FileInputStream(f);
    XSSFWorkbook workbook = new XSSFWorkbook(file);
    XSSFSheet sheet = workbook.getSheetAt(0);
    sheet.shiftRows(currentRow, currentRow + amount, amount, true, true);
    file.close();
    FileOutputStream out = new FileOutputStream(f);
    workbook.write(out);
    out.close();
}
Run Code Online (Sandbox Code Playgroud)

但不幸的是,它删除了行中的一些行以适应这种转变。删除的行似乎是随机的,它们实际上并不直接位于移位行的下方或上方。如果我移动不止一行,它们似乎发生在移动的行之间。

预先感谢您的帮助。

java apache excel apache-poi

0
推荐指数
1
解决办法
8352
查看次数

标签 统计

excel ×5

apache-poi ×4

java ×4

apache ×1

excel-formula ×1