mirror of
https://gitee.com/dromara/hutool.git
synced 2025-07-16 16:50:45 +08:00
fix code
This commit is contained in:
parent
5f5087c093
commit
8d5851a81f
@ -1,6 +1,6 @@
|
||||
/**
|
||||
* 单元格值编辑器,内部使用
|
||||
* @author looly
|
||||
*
|
||||
* @author looly
|
||||
*/
|
||||
package cn.hutool.poi.excel.cell.editors;
|
||||
|
@ -0,0 +1,6 @@
|
||||
/**
|
||||
* 单元格值自定义设置器,主要用于Excel数据导出,用户通过自定义此接口,实现可定制化的单元格值设定
|
||||
*
|
||||
* @author looly
|
||||
*/
|
||||
package cn.hutool.poi.excel.cell.setters;
|
@ -1,5 +1,7 @@
|
||||
package cn.hutool.poi.excel.cell;
|
||||
package cn.hutool.poi.excel.cell.values;
|
||||
|
||||
import cn.hutool.poi.excel.cell.CellSetter;
|
||||
import cn.hutool.poi.excel.cell.CellValue;
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
|
||||
/**
|
@ -0,0 +1,6 @@
|
||||
/**
|
||||
* 不同类型单元格值的封装
|
||||
*
|
||||
* @author looly
|
||||
*/
|
||||
package cn.hutool.poi.excel.cell.values;
|
@ -2,7 +2,7 @@ package cn.hutool.poi.excel.sax;
|
||||
|
||||
import cn.hutool.core.text.StrUtil;
|
||||
import cn.hutool.core.util.ObjUtil;
|
||||
import cn.hutool.poi.excel.cell.FormulaCellValue;
|
||||
import cn.hutool.poi.excel.cell.values.FormulaCellValue;
|
||||
import cn.hutool.poi.excel.sax.handler.RowHandler;
|
||||
import org.apache.poi.ss.usermodel.BuiltinFormats;
|
||||
import org.apache.poi.xssf.model.SharedStrings;
|
||||
|
@ -6,7 +6,7 @@ import cn.hutool.core.io.FileUtil;
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.core.lang.Console;
|
||||
import cn.hutool.core.text.StrUtil;
|
||||
import cn.hutool.poi.excel.cell.FormulaCellValue;
|
||||
import cn.hutool.poi.excel.cell.values.FormulaCellValue;
|
||||
import cn.hutool.poi.excel.sax.Excel03SaxReader;
|
||||
import cn.hutool.poi.excel.sax.handler.RowHandler;
|
||||
import cn.hutool.poi.exceptions.POIException;
|
||||
|
@ -45,7 +45,7 @@ import java.util.TreeMap;
|
||||
public class ExcelWriteTest {
|
||||
|
||||
@Test
|
||||
public void writeNoFlushTest(){
|
||||
public void writeNoFlushTest() {
|
||||
final List<?> row1 = ListUtil.of("aaaaa", "bb", "cc", "dd", DateUtil.date(), 3.22676575765);
|
||||
final List<?> row2 = ListUtil.of("aa1", "bb1", "cc1", "dd1", DateUtil.date(), 250.7676);
|
||||
final List<?> row3 = ListUtil.of("aa2", "bb2", "cc2", "dd2", DateUtil.date(), 0.111);
|
||||
@ -617,7 +617,7 @@ public class ExcelWriteTest {
|
||||
|
||||
final Font headFont = writer.createFont();
|
||||
headFont.setBold(true);
|
||||
headFont.setFontHeightInPoints((short)50);
|
||||
headFont.setFontHeightInPoints((short) 50);
|
||||
headFont.setFontName("Microsoft YaHei");
|
||||
writer.getStyleSet().getHeadCellStyle().setFont(headFont);
|
||||
|
||||
@ -755,20 +755,20 @@ public class ExcelWriteTest {
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void mergeTest3(){
|
||||
public void mergeTest3() {
|
||||
// https://github.com/dromara/hutool/issues/1696
|
||||
|
||||
final List<Map<String,Object>> list = new ArrayList<>();
|
||||
final Map<String,Object> map = new HashMap<>();
|
||||
map.put("xmnf","2021");
|
||||
final List<Map<String, Object>> list = new ArrayList<>();
|
||||
final Map<String, Object> map = new HashMap<>();
|
||||
map.put("xmnf", "2021");
|
||||
list.add(map);
|
||||
|
||||
final Map<String,Object> map1 = new HashMap<>();
|
||||
map1.put("xmnf",new XSSFRichTextString("9999"));
|
||||
final Map<String, Object> map1 = new HashMap<>();
|
||||
map1.put("xmnf", new XSSFRichTextString("9999"));
|
||||
list.add(map1);
|
||||
|
||||
final Map<String,Object> map2 = new HashMap<>();
|
||||
map2.put("xmnf","2019");
|
||||
final Map<String, Object> map2 = new HashMap<>();
|
||||
map2.put("xmnf", "2019");
|
||||
list.add(map2);
|
||||
|
||||
//通过工具类创建writer
|
||||
@ -785,7 +785,7 @@ public class ExcelWriteTest {
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void mergeForDateTest(){
|
||||
public void mergeForDateTest() {
|
||||
// https://github.com/dromara/hutool/issues/1911
|
||||
|
||||
//通过工具类创建writer
|
||||
@ -798,7 +798,7 @@ public class ExcelWriteTest {
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void changeHeaderStyleTest(){
|
||||
public void changeHeaderStyleTest() {
|
||||
final ExcelWriter writer = ExcelUtil.getWriter("d:/test/headerStyle.xlsx");
|
||||
writer.writeHeadRow(ListUtil.view("姓名", "性别", "年龄"));
|
||||
final CellStyle headCellStyle = writer.getStyleSet().getHeadCellStyle();
|
||||
@ -810,7 +810,7 @@ public class ExcelWriteTest {
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void writeFloatTest(){
|
||||
public void writeFloatTest() {
|
||||
//issue https://gitee.com/dromara/hutool/issues/I43U9G
|
||||
final String path = "d:/test/floatTest.xlsx";
|
||||
FileUtil.del(path);
|
||||
@ -822,7 +822,7 @@ public class ExcelWriteTest {
|
||||
|
||||
@Test
|
||||
//@Ignore
|
||||
public void writeDoubleTest(){
|
||||
public void writeDoubleTest() {
|
||||
// https://gitee.com/dromara/hutool/issues/I5PI5C
|
||||
final String path = "d:/test/doubleTest.xlsx";
|
||||
FileUtil.del(path);
|
||||
@ -835,7 +835,7 @@ public class ExcelWriteTest {
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void issueI466ZZTest(){
|
||||
public void issueI466ZZTest() {
|
||||
// https://gitee.com/dromara/hutool/issues/I466ZZ
|
||||
// 需要输出S_20000314_x5116_0004
|
||||
// 此处加入一个转义前缀:_x005F
|
||||
@ -848,7 +848,7 @@ public class ExcelWriteTest {
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void writeLongTest(){
|
||||
public void writeLongTest() {
|
||||
//https://gitee.com/dromara/hutool/issues/I49R6U
|
||||
final ExcelWriter writer = ExcelUtil.getWriter("d:/test/long.xlsx");
|
||||
writer.write(ListUtil.view(1427545395336093698L));
|
||||
@ -857,8 +857,8 @@ public class ExcelWriteTest {
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void writeHyperlinkTest(){
|
||||
final ExcelWriter writer = ExcelUtil.getWriter("d:/test/hyperlink.xlsx");
|
||||
public void writeHyperlinkTest() {
|
||||
final ExcelWriter writer = ExcelUtil.getWriter("d:/test/hyperlink.xlsx");
|
||||
|
||||
final Hyperlink hyperlink = writer.createHyperlink(HyperlinkType.URL, "https://hutool.cn");
|
||||
|
||||
@ -868,12 +868,12 @@ public class ExcelWriteTest {
|
||||
|
||||
@Test
|
||||
@Ignore
|
||||
public void mergeNumberTest(){
|
||||
final File tempFile=new File("d:/test/mergeNumber.xlsx");
|
||||
public void mergeNumberTest() {
|
||||
final File tempFile = new File("d:/test/mergeNumber.xlsx");
|
||||
FileUtil.del(tempFile);
|
||||
|
||||
final BigExcelWriter writer= new BigExcelWriter(tempFile);
|
||||
writer.merge(0,1,2,2,3.99,false);
|
||||
final BigExcelWriter writer = new BigExcelWriter(tempFile);
|
||||
writer.merge(0, 1, 2, 2, 3.99, false);
|
||||
writer.close();
|
||||
}
|
||||
|
||||
@ -892,7 +892,7 @@ public class ExcelWriteTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getDispositionTest(){
|
||||
public void getDispositionTest() {
|
||||
final ExcelWriter writer = ExcelUtil.getWriter(true);
|
||||
final String disposition = writer.getDisposition("测试A12.xlsx", CharsetUtil.UTF_8);
|
||||
Assert.assertEquals("attachment; filename=\"%E6%B5%8B%E8%AF%95A12.xlsx\"", disposition);
|
||||
|
Loading…
Reference in New Issue
Block a user