You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Apache POI生成Word文档希伯来语内容误报拼写检查警告求助

希伯来语内容通过Apache POI注入Word表格后触发错误拼写检查的问题

我用Java结合Apache POI开发了一个程序,功能是从现有Word文档提取内容,注入到基于模板生成的新文档表格中,内容大多是希伯来语。

问题:所有生成的内容都显示拼写检查警告(见截图),但实际拼写完全正确。
问题截图

把内容复制到其他文档也解决不了这个问题,但手动输入相同内容时拼写检查正常。这个问题很棘手,谷歌搜过没找到解决方案,求解决思路。

以下是向表格注入内容的方法代码:

public boolean fillInTable() throws IOException {
    System.out.println("fillInTable -current data = " + data);
    XWPFTable table = document.getTables().get(0);
    boolean moreResults = false;
    ListIterator<MichrazOutputLine> lines = data.listIterator();
    while(lines.hasNext()) {
        XWPFTableRow row4 = table.getRow(table.getRows().size() - 1);
        XWPFTableRow tableRow = table.createRow();
        MichrazOutputLine currLine = lines.next();
        tableRow.getCell(0).setText((rowIndex++) + ".");
        for(int i = 0; i < parameters.size(); i++) {
            SearchParameter<?> curr = parameters.get(i);
            if(curr.isOutput()) {
                String value = "";
                switch(curr.getAppCriteria()){
                case CUSTOMER_NAME:
                    value = currLine.getCustomerName();
                    break;
                case DATE:
                    value = currLine.getYear();
                    break;
                case EMPLOYEES_NUMBER:
                    value = currLine.getEmployeeNum();
                    break;
                case PROJECT_DESCRIPTION:
                    value = currLine.getProjectDescription();
                    break;
                case WORK_HOURS:
                    value = currLine.getWorkHoursSum();
                    break;
                case BUDGET:
                    value = currLine.getBudget();
                    break;
                case RECOMMENDER:
                    value = currLine.getRecommender();
                    break;
                case FILE_PATH:
                    value = currLine.getFilePath();
                    break;
                }           
                tableRow.getCell(curr.getOutputCellIndex()).setText(value);
            }
        }
        lines.remove();
        if(table.getRows().size()-1> maxResult-1) {
            dataFull = true;
            System.out.println("fillInTable -data finished  = " + data);
            return true;
        }   
    }
    System.out.println("fillInTable -data finished  = " + data);
    return moreResults;//true - continue the process
}

内容的提问来源于stack exchange,提问作者lingar

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.24 09:51:15