mirror of
https://gitee.com/dromara/hutool.git
synced 2025-04-05 17:37:59 +08:00
fix test
This commit is contained in:
parent
bee80f3d14
commit
829fecdc38
@ -1,11 +1,7 @@
|
||||
package cn.hutool.poi.excel;
|
||||
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import org.apache.poi.ss.usermodel.BuiltinFormats;
|
||||
import org.apache.poi.ss.usermodel.CellStyle;
|
||||
import org.apache.poi.ss.usermodel.IgnoredErrorType;
|
||||
import org.apache.poi.ss.util.CellRangeAddress;
|
||||
import org.apache.poi.xssf.usermodel.XSSFSheet;
|
||||
import cn.hutool.poi.excel.cell.FormulaCellValue;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
@ -13,15 +9,11 @@ public class WriteNumberToStringTest {
|
||||
@Test
|
||||
@Ignore
|
||||
public void writeNumberTest() {
|
||||
final ExcelWriter writer = ExcelUtil.getWriter("d:/test/dataWithNumber.xlsx");
|
||||
final XSSFSheet sheet = (XSSFSheet) writer.getSheet();
|
||||
sheet.addIgnoredErrors(new CellRangeAddress(0, 100, 0, 100), IgnoredErrorType.NUMBER_STORED_AS_TEXT);
|
||||
final CellStyle cellStyle = writer.getStyleSet().getCellStyle();
|
||||
cellStyle.setDataFormat((short) BuiltinFormats.getBuiltinFormat("TEXT"));
|
||||
final ExcelWriter writer = ExcelUtil.getBigWriter("d:/test/dataWithNumber.xlsx");
|
||||
|
||||
writer.writeRow(ListUtil.of("姓名", "编号"));
|
||||
writer.writeRow(ListUtil.of("张三", "010001"));
|
||||
writer.writeRow(ListUtil.of("李四", "120001"));
|
||||
writer.writeRow(ListUtil.of("张三", new FormulaCellValue("010001")));
|
||||
writer.writeRow(ListUtil.of("李四", new FormulaCellValue("120001")));
|
||||
writer.writeRow(ListUtil.of("王五", 123456));
|
||||
|
||||
writer.close();
|
||||
|
Loading…
Reference in New Issue
Block a user