mirror of
https://gitee.com/dromara/hutool.git
synced 2025-06-28 13:34:09 +08:00
fix test
This commit is contained in:
parent
bee80f3d14
commit
829fecdc38
@ -1,11 +1,7 @@
|
|||||||
package cn.hutool.poi.excel;
|
package cn.hutool.poi.excel;
|
||||||
|
|
||||||
import cn.hutool.core.collection.ListUtil;
|
import cn.hutool.core.collection.ListUtil;
|
||||||
import org.apache.poi.ss.usermodel.BuiltinFormats;
|
import cn.hutool.poi.excel.cell.FormulaCellValue;
|
||||||
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 org.junit.Ignore;
|
import org.junit.Ignore;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
|
||||||
@ -13,15 +9,11 @@ public class WriteNumberToStringTest {
|
|||||||
@Test
|
@Test
|
||||||
@Ignore
|
@Ignore
|
||||||
public void writeNumberTest() {
|
public void writeNumberTest() {
|
||||||
final ExcelWriter writer = ExcelUtil.getWriter("d:/test/dataWithNumber.xlsx");
|
final ExcelWriter writer = ExcelUtil.getBigWriter("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"));
|
|
||||||
|
|
||||||
writer.writeRow(ListUtil.of("姓名", "编号"));
|
writer.writeRow(ListUtil.of("姓名", "编号"));
|
||||||
writer.writeRow(ListUtil.of("张三", "010001"));
|
writer.writeRow(ListUtil.of("张三", new FormulaCellValue("010001")));
|
||||||
writer.writeRow(ListUtil.of("李四", "120001"));
|
writer.writeRow(ListUtil.of("李四", new FormulaCellValue("120001")));
|
||||||
writer.writeRow(ListUtil.of("王五", 123456));
|
writer.writeRow(ListUtil.of("王五", 123456));
|
||||||
|
|
||||||
writer.close();
|
writer.close();
|
||||||
|
Loading…
Reference in New Issue
Block a user