DOCX在表中不支持超过63列? [英] DOCX does not support more than 63 columns in a table?

查看:569
本文介绍了DOCX在表中不支持超过63列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在使用Jasper Report 6.1.0或5.6.0 jar但无法找到任何答案

We are using Jasper Report 6.1.0 or 5.6.0 jar but not able to find any answer over it

JasperPrint jasperPrint=JasperFillManager.fillReport(sourceFileName, parameters, new JREmptyDataSource());
System.out.println("started bossssssssssssssssss");
JRDocxExporter exporter = new JRDocxExporter();
exporter.setExporterInput(new SimpleExporterInput(jasperPrint));
File exportReportFile = new File("/home/ist-140/filename.docx");
exporter.setExporterOutput(new SimpleOutputStreamExporterOutput(exportReportFile));
    // exporter.setParameter(JRDocxExporterParameter.JASPER_PRINT, jasperPrint);
exporter.exportReport(); 

错误是:

net.sf.jasperreports.engine.JRException: The DOCX format does not support more than 63 columns in a table

对于表限制中的63列,以下哪一项为真:

For the 63 columns in a table limit, which of the following are true:


  • 其限制在文件格式/规范

  • 其在某些/所有版本的Word中的限制

  • 其Jasper限制

推荐答案

JasperReports 引擎在 JRDocxExporter 的帮助下执行导出检查。如果列数超过 63 ,则会引发异常。

This JasperReports engine performs check during export with help of JRDocxExporter. In case having more than 63 columns it raises exception.

正如您所见,此代码执行检查< JRDocxExporter 类的strong> exportGrid 方法:

As you can see this code performs check at exportGrid method of JRDocxExporter class:

protected void exportGrid(JRGridLayout gridLayout, JRPrintElementIndex frameIndex) throws JRException {
    CutsInfo xCuts = gridLayout.getXCuts();
    Grid grid = gridLayout.getGrid();
    DocxTableHelper tableHelper = null;

    int rowCount = grid.getRowCount();
    if (rowCount > 0 && grid.getColumnCount() > 63)     {
        throw new JRException(EXCEPTION_MESSAGE_KEY_COLUMN_COUNT_OUT_OF_RANGE,  
                new Object[]{grid.getColumnCount()} 
                ); 
    }

这是 JR 6.3.0的实施片段


  1. 此实现的根源是 MS Word 的限制。
    有关此限制的一些信息,请访问:表格列限制及其计算方法

可以找到 Teodor Danciu 对问题的解释这里

The explanation of problem by Teodor Danciu can be found here

当前版本的 JRDocxExporter 类的源代码是< a href =https://github.com/TIBCOSoftware/jasperreports/blob/master/jasperreports/src/net/sf/jasperreports/engine/export/ooxml/JRDocxExporter.java =nofollow noreferrer> here

The source code of current version of JRDocxExporter class is here

这篇关于DOCX在表中不支持超过63列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆