Giter VIP home page Giter VIP logo

excelutil's Issues

在引入到安卓项目后,发生依赖冲突

org.gradle.execution.MultipleBuildFailures: Build completed with 1 failures
——————————————————————————————————————————
duplicate class org.apache.commons.collections.arraystack found in modules commons-beanutils-1.8.3.jar (commons-beanutils:commons-beanutils:1.8.3) and commons-collections-3.2.1.jar (commons-collections:commons-collections:3.2.1

——————————————————————————————————————————
Duplicate class org.apache.commons.collections.ArrayStack found in modules commons-beanutils-1.8.3.jar (commons-beanutils:commons-beanutils:1.8.3) and commons-collections-3.1.jar (apache-collections:commons-collections:3.1)
Duplicate class org.apache.commons.collections.Buffer found in modules commons-beanutils-1.8.3.jar (commons-beanutils:commons-beanutils:1.8.3) and commons-collections-3.1.jar (apache-collections:commons-collections:3.1)
Duplicate class org.apache.commons.collections.BufferUnderflowException found in modules commons-beanutils-1.8.3.jar (commons-beanutils:commons-beanutils:1.8.3) and commons-collections-3.1.jar (apache-collections:commons-collections:3.1)
Duplicate class org.apache.commons.collections.FastHashMap found in modules commons-beanutils-1.8.3.jar (commons-beanutils:commons-beanutils:1.8.3) and commons-collections-3.1.jar (apache-collections:commons-collections:3.1)
Duplicate class org.apache.commons.collections.FastHashMap$1 found in modules commons-beanutils-1.8.3.jar (commons-beanutils:commons-beanutils:1.8.3) and commons-collections-3.1.jar (apache-collections:commons-collections:3.1)
Duplicate class org.apache.commons.collections.FastHashMap$CollectionView found in modules commons-beanutils-1.8.3.jar (commons-beanutils:commons-beanutils:1.8.3) and commons-collections-3.1.jar (apache-collections:commons-collections:3.1)
Duplicate class org.apache.commons.collections.FastHashMap$CollectionView$CollectionViewIterator found in modules commons-beanutils-1.8.3.jar (commons-beanutils:commons-beanutils:1.8.3) and commons-collections-3.1.jar (apache-collections:commons-collections:3.1)
Duplicate class org.apache.commons.collections.FastHashMap$EntrySet found in modules commons-beanutils-1.8.3.jar (commons-beanutils:commons-beanutils:1.8.3) and commons-collections-3.1.jar (apache-collections:commons-collections:3.1)
Duplicate class org.apache.commons.collections.FastHashMap$KeySet found in modules commons-beanutils-1.8.3.jar (commons-beanutils:commons-beanutils:1.8.3) and commons-collections-3.1.jar (apache-collections:commons-collections:3.1)
Duplicate class org.apache.commons.collections.FastHashMap$Values found in modules commons-beanutils-1.8.3.jar (commons-beanutils:commons-beanutils:1.8.3) and commons-collections-3.1.jar (apache-collections:commons-collections:3.1)
Duplicate class org.apache.xmlbeans.xml.stream.Location found in modules xmlbeans-2.6.0.jar (org.apache.xmlbeans:xmlbeans:2.6.0) and xmlbeans-2.6.0.jar (org.apache.xmlbeans:xmlbeans:2.6.0)
Duplicate class org.apache.xmlbeans.xml.stream.ReferenceResolver found in modules xmlbeans-2.6.0.jar (org.apache.xmlbeans:xmlbeans:2.6.0) and xmlbeans-2.6.0.jar (org.apache.xmlbeans:xmlbeans:2.6.0)
Duplicate class org.apache.xmlbeans.xml.stream.XMLEvent found in modules xmlbeans-2.6.0.jar (org.apache.xmlbeans:xmlbeans:2.6.0) and xmlbeans-2.6.0.jar (org.apache.xmlbeans:xmlbeans:2.6.0)
Duplicate class org.apache.xmlbeans.xml.stream.XMLInputStream found in modules xmlbeans-2.6.0.jar (org.apache.xmlbeans:xmlbeans:2.6.0) and xmlbeans-2.6.0.jar (org.apache.xmlbeans:xmlbeans:2.6.0)
Duplicate class org.apache.xmlbeans.xml.stream.XMLName found in modules xmlbeans-2.6.0.jar (org.apache.xmlbeans:xmlbeans:2.6.0) and xmlbeans-2.6.0.jar (org.apache.xmlbeans:xmlbeans:2.6.0)
Duplicate class org.apache.xmlbeans.xml.stream.XMLStreamException found in modules xmlbeans-2.6.0.jar (org.apache.xmlbeans:xmlbeans:2.6.0) and xmlbeans-2.6.0.jar (org.apache.xmlbeans:xmlbeans:2.6.0)
Duplicate class org.apache.xmlbeans.xml.stream.utils.NestedThrowable found in modules xmlbeans-2.6.0.jar (org.apache.xmlbeans:xmlbeans:2.6.0) and xmlbeans-2.6.0.jar (org.apache.xmlbeans:xmlbeans:2.6.0)
Duplicate class org.apache.xmlbeans.xml.stream.utils.NestedThrowable$Util found in modules xmlbeans-2.6.0.jar (org.apache.xmlbeans:xmlbeans:2.6.0) and xmlbeans-2.6.0.jar (org.apache.xmlbeans:xmlbeans:2.6.0)

导出Excel时,Model对象可以不使用注解指定index

既然已经使用了 LinkedHashMap 按顺序指定了属性名和对应的列名,完全可以直接使用属性名来按顺序取Model对象对应值就可以了,不使用 @ExcelCell(index = ?) 注解来指定列的位置也可以进行导出,导出列很多的情况下标注每个的对象的位置很麻烦。

主要是在导出时,添加注解对导出对象有一定的侵入性,不想新建一个专门用来导出数据的对象并进行数据拷贝。

转换日期问题

我根据方法要求吧传入的日期按照日期格式输入好(如yyyy/MM/dd) 但是输出的内容并不是Date类型(内容为:43039.3816203704)

如果類型不在指定範圍內,並且沒有默認值

// 如果類型不在指定範圍內,並且沒有默認值
            if (!(cellTypes.contains(cell.getCellTypeEnum()))
                    || isNotBlank(annoCell.defaultValue())
                    && cell.getCellTypeEnum() == CellType.STRING) {
                StringBuilder strType = new StringBuilder();
                for (int i = 0; i < cellTypes.size(); i++) {
                    CellType cellType = cellTypes.get(i);
                    strType.append(getCellTypeByInt(cellType));
                    if (i != cellTypes.size() - 1) {
                        strType.append(",");
                    }
                }
                result =
                        MessageFormat.format("the cell [{0}] type must [{1}]", columnName, strType.toString());
            } 

这个地方没看懂, 没有默认值,不应该是 isBlank(annoCell.defaultValue()) 吗? 是不是应该改为

// 如果類型不在指定範圍內,並且沒有默認值
            if (!(cellTypes.contains(cell.getCellTypeEnum()))
                    && isBlank(annoCell.defaultValue())) {
                StringBuilder strType = new StringBuilder();
                for (int i = 0; i < cellTypes.size(); i++) {
                    CellType cellType = cellTypes.get(i);
                    strType.append(getCellTypeByInt(cellType));
                    if (i != cellTypes.size() - 1) {
                        strType.append(",");
                    }
                }
                result =
                        MessageFormat.format("the cell [{0}] type must [{1}]", columnName, strType.toString());
            } 

引入Maven依赖失败

添加笔主给的Maven依赖pom.xml项目上会有感叹号错误(猜测是jar包导入错误)

Excel单元格为空, 采用Map导入报错

错误: Cannot get a STRING value from a NUMERIC cell.

修改如下,希望作者加入master

ExcelUtil.java(448行)

for (String k : titleMap.keySet()) {
Integer index = titleMap.get(k);
Cell cell = row.getCell(index);
// 判空
if (cell == null) {
map.put(k, null);
} else {
cell.setCellType(CellType.STRING);
String value = cell.getStringCellValue();
map.put(k, value);
}
}

单元格样式设置问题

如何单独给表头和非表头设置独立的样式,比如我要给表头设置文字加粗,非标头默认样式显示,不加粗,刚开始使用cell.setCellStyle(style);会报错,后来在网上查了要这样写“cell.getCellStyle().cloneStyleFrom(style);”,倒是可以加粗,但是所有单元格都加粗了

引入安卓项目:Duplicate class org.apache.commons.collections.ArrayStack found in modules commons-beanutils-1.8.3 (commons-beanutils:commons-beanutils:1.8.3) and commons-collections-3.2.1 (commons-collections:commons-collections:3.2.1)

Execution failed for task ':app:checkDebugDuplicateClasses'.

A failure occurred while executing com.android.build.gradle.internal.tasks.CheckDuplicatesRunnable
Duplicate class org.apache.commons.collections.ArrayStack found in modules commons-beanutils-1.8.3 (commons-beanutils:commons-beanutils:1.8.3) and commons-collections-3.2.1 (commons-collections:commons-collections:3.2.1)
Duplicate class org.apache.commons.collections.Buffer found in modules commons-beanutils-1.8.3 (commons-beanutils:commons-beanutils:1.8.3) and commons-collections-3.2.1 (commons-collections:commons-collections:3.2.1)
Duplicate class org.apache.commons.collections.BufferUnderflowException found in modules commons-beanutils-1.8.3 (commons-beanutils:commons-beanutils:1.8.3) and commons-collections-3.2.1 (commons-collections:commons-collections:3.2.1)
Duplicate class org.apache.commons.collections.FastHashMap found in modules commons-beanutils-1.8.3 (commons-beanutils:commons-beanutils:1.8.3) and commons-collections-3.2.1 (commons-collections:commons-collections:3.2.1)
Duplicate class org.apache.commons.collections.FastHashMap$1 found in modules commons-beanutils-1.8.3 (commons-beanutils:commons-beanutils:1.8.3) and commons-collections-3.2.1 (commons-collections:commons-collections:3.2.1)
Duplicate class org.apache.commons.collections.FastHashMap$CollectionView found in modules commons-beanutils-1.8.3 (commons-beanutils:commons-beanutils:1.8.3) and commons-collections-3.2.1 (commons-collections:commons-collections:3.2.1)
Duplicate class org.apache.commons.collections.FastHashMap$CollectionView$CollectionViewIterator found in modules commons-beanutils-1.8.3 (commons-beanutils:commons-beanutils:1.8.3) and commons-collections-3.2.1 (commons-collections:commons-collections:3.2.1)
Duplicate class org.apache.commons.collections.FastHashMap$EntrySet found in modules commons-beanutils-1.8.3 (commons-beanutils:commons-beanutils:1.8.3) and commons-collections-3.2.1 (commons-collections:commons-collections:3.2.1)
Duplicate class org.apache.commons.collections.FastHashMap$KeySet found in modules commons-beanutils-1.8.3 (commons-beanutils:commons-beanutils:1.8.3) and commons-collections-3.2.1 (commons-collections:commons-collections:3.2.1)
Duplicate class org.apache.commons.collections.FastHashMap$Values found in modules commons-beanutils-1.8.3 (commons-beanutils:commons-beanutils:1.8.3) and commons-collections-3.2.1 (commons-collections:commons-collections:3.2.1)
Duplicate class org.apache.xmlbeans.xml.stream.Location found in modules xmlbeans-2.6.0 (org.apache.xmlbeans:xmlbeans:2.6.0) and xmlbeans-2.6.0 (org.apache.xmlbeans:xmlbeans:2.6.0)
Duplicate class org.apache.xmlbeans.xml.stream.ReferenceResolver found in modules xmlbeans-2.6.0 (org.apache.xmlbeans:xmlbeans:2.6.0) and xmlbeans-2.6.0 (org.apache.xmlbeans:xmlbeans:2.6.0)
Duplicate class org.apache.xmlbeans.xml.stream.XMLEvent found in modules xmlbeans-2.6.0 (org.apache.xmlbeans:xmlbeans:2.6.0) and xmlbeans-2.6.0 (org.apache.xmlbeans:xmlbeans:2.6.0)
Duplicate class org.apache.xmlbeans.xml.stream.XMLInputStream found in modules xmlbeans-2.6.0 (org.apache.xmlbeans:xmlbeans:2.6.0) and xmlbeans-2.6.0 (org.apache.xmlbeans:xmlbeans:2.6.0)
Duplicate class org.apache.xmlbeans.xml.stream.XMLName found in modules xmlbeans-2.6.0 (org.apache.xmlbeans:xmlbeans:2.6.0) and xmlbeans-2.6.0 (org.apache.xmlbeans:xmlbeans:2.6.0)
Duplicate class org.apache.xmlbeans.xml.stream.XMLStreamException found in modules xmlbeans-2.6.0 (org.apache.xmlbeans:xmlbeans:2.6.0) and xmlbeans-2.6.0 (org.apache.xmlbeans:xmlbeans:2.6.0)
Duplicate class org.apache.xmlbeans.xml.stream.utils.NestedThrowable found in modules xmlbeans-2.6.0 (org.apache.xmlbeans:xmlbeans:2.6.0) and xmlbeans-2.6.0 (org.apache.xmlbeans:xmlbeans:2.6.0)
Duplicate class org.apache.xmlbeans.xml.stream.utils.NestedThrowable$Util found in modules xmlbeans-2.6.0 (org.apache.xmlbeans:xmlbeans:2.6.0) and xmlbeans-2.6.0 (org.apache.xmlbeans:xmlbeans:2.6.0)

  • Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

列宽自适应 升级jar包

感谢楼主的分享,不过在使用过程中设置的列宽自适应仍然不会生效,部分方法已过时,作者如果有时间要是能升级这2块就完美了!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.