mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-05-09 23:51:34 +08:00
fix code
This commit is contained in:
parent
24803f8f0c
commit
d53d7a966c
@ -298,12 +298,12 @@ public class ExcelUtil {
|
|||||||
/**
|
/**
|
||||||
* 获得{@link ExcelWriter},默认写出到第一个sheet
|
* 获得{@link ExcelWriter},默认写出到第一个sheet
|
||||||
*
|
*
|
||||||
* @param destFilePath 目标文件路径
|
* @param templateFilePath 模板文件路径
|
||||||
* @return {@link ExcelWriter}
|
* @return {@link ExcelWriter}
|
||||||
*/
|
*/
|
||||||
public static ExcelWriter getWriter(final String destFilePath) {
|
public static ExcelWriter getWriter(final String templateFilePath) {
|
||||||
try {
|
try {
|
||||||
return new ExcelWriter(destFilePath);
|
return new ExcelWriter(templateFilePath);
|
||||||
} catch (final NoClassDefFoundError e) {
|
} catch (final NoClassDefFoundError e) {
|
||||||
throw new DependencyException(ObjUtil.defaultIfNull(e.getCause(), e), PoiChecker.NO_POI_ERROR_MSG);
|
throw new DependencyException(ObjUtil.defaultIfNull(e.getCause(), e), PoiChecker.NO_POI_ERROR_MSG);
|
||||||
}
|
}
|
||||||
@ -327,12 +327,12 @@ public class ExcelUtil {
|
|||||||
/**
|
/**
|
||||||
* 获得{@link ExcelWriter},默认写出到第一个sheet,名字为sheet1
|
* 获得{@link ExcelWriter},默认写出到第一个sheet,名字为sheet1
|
||||||
*
|
*
|
||||||
* @param destFile 目标文件
|
* @param templateFile 目标文件
|
||||||
* @return {@link ExcelWriter}
|
* @return {@link ExcelWriter}
|
||||||
*/
|
*/
|
||||||
public static ExcelWriter getWriter(final File destFile) {
|
public static ExcelWriter getWriter(final File templateFile) {
|
||||||
try {
|
try {
|
||||||
return new ExcelWriter(destFile);
|
return new ExcelWriter(templateFile);
|
||||||
} catch (final NoClassDefFoundError e) {
|
} catch (final NoClassDefFoundError e) {
|
||||||
throw new DependencyException(ObjUtil.defaultIfNull(e.getCause(), e), PoiChecker.NO_POI_ERROR_MSG);
|
throw new DependencyException(ObjUtil.defaultIfNull(e.getCause(), e), PoiChecker.NO_POI_ERROR_MSG);
|
||||||
}
|
}
|
||||||
@ -341,13 +341,13 @@ public class ExcelUtil {
|
|||||||
/**
|
/**
|
||||||
* 获得{@link ExcelWriter}
|
* 获得{@link ExcelWriter}
|
||||||
*
|
*
|
||||||
* @param destFilePath 目标文件路径
|
* @param templateFilePath 目标文件路径
|
||||||
* @param sheetName sheet表名
|
* @param sheetName sheet表名
|
||||||
* @return {@link ExcelWriter}
|
* @return {@link ExcelWriter}
|
||||||
*/
|
*/
|
||||||
public static ExcelWriter getWriter(final String destFilePath, final String sheetName) {
|
public static ExcelWriter getWriter(final String templateFilePath, final String sheetName) {
|
||||||
try {
|
try {
|
||||||
return new ExcelWriter(destFilePath, sheetName);
|
return new ExcelWriter(templateFilePath, sheetName);
|
||||||
} catch (final NoClassDefFoundError e) {
|
} catch (final NoClassDefFoundError e) {
|
||||||
throw new DependencyException(ObjUtil.defaultIfNull(e.getCause(), e), PoiChecker.NO_POI_ERROR_MSG);
|
throw new DependencyException(ObjUtil.defaultIfNull(e.getCause(), e), PoiChecker.NO_POI_ERROR_MSG);
|
||||||
}
|
}
|
||||||
@ -356,13 +356,13 @@ public class ExcelUtil {
|
|||||||
/**
|
/**
|
||||||
* 获得{@link ExcelWriter}
|
* 获得{@link ExcelWriter}
|
||||||
*
|
*
|
||||||
* @param destFile 目标文件
|
* @param templateFilePath 目标文件
|
||||||
* @param sheetName sheet表名
|
* @param sheetName sheet表名
|
||||||
* @return {@link ExcelWriter}
|
* @return {@link ExcelWriter}
|
||||||
*/
|
*/
|
||||||
public static ExcelWriter getWriter(final File destFile, final String sheetName) {
|
public static ExcelWriter getWriter(final File templateFilePath, final String sheetName) {
|
||||||
try {
|
try {
|
||||||
return new ExcelWriter(destFile, sheetName);
|
return new ExcelWriter(templateFilePath, sheetName);
|
||||||
} catch (final NoClassDefFoundError e) {
|
} catch (final NoClassDefFoundError e) {
|
||||||
throw new DependencyException(ObjUtil.defaultIfNull(e.getCause(), e), PoiChecker.NO_POI_ERROR_MSG);
|
throw new DependencyException(ObjUtil.defaultIfNull(e.getCause(), e), PoiChecker.NO_POI_ERROR_MSG);
|
||||||
}
|
}
|
||||||
|
@ -90,10 +90,10 @@ public class ExcelWriter extends ExcelBase<ExcelWriter, ExcelWriteConfig> {
|
|||||||
/**
|
/**
|
||||||
* 构造,默认写出到第一个sheet,第一个sheet名为sheet1
|
* 构造,默认写出到第一个sheet,第一个sheet名为sheet1
|
||||||
*
|
*
|
||||||
* @param destFilePath 目标文件路径,可以不存在
|
* @param templateFilePath 模板文件,不存在则默认为目标写出文件
|
||||||
*/
|
*/
|
||||||
public ExcelWriter(final String destFilePath) {
|
public ExcelWriter(final String templateFilePath) {
|
||||||
this(destFilePath, null);
|
this(templateFilePath, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -112,33 +112,33 @@ public class ExcelWriter extends ExcelBase<ExcelWriter, ExcelWriteConfig> {
|
|||||||
/**
|
/**
|
||||||
* 构造
|
* 构造
|
||||||
*
|
*
|
||||||
* @param destFilePath 目标文件路径,可以不存在
|
* @param templateFilePath 模板文件,不存在则默认为目标写出文件
|
||||||
* @param sheetName sheet名,第一个sheet名并写出到此sheet,例如sheet1
|
* @param sheetName sheet名,第一个sheet名并写出到此sheet,例如sheet1
|
||||||
*/
|
*/
|
||||||
public ExcelWriter(final String destFilePath, final String sheetName) {
|
public ExcelWriter(final String templateFilePath, final String sheetName) {
|
||||||
this(FileUtil.file(destFilePath), sheetName);
|
this(FileUtil.file(templateFilePath), sheetName);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 构造,默认写出到第一个sheet,第一个sheet名为sheet1
|
* 构造,默认写出到第一个sheet,第一个sheet名为sheet1
|
||||||
*
|
*
|
||||||
* @param destFile 目标文件,可以不存在
|
* @param templateFile 模板文件,不存在则默认为目标写出文件
|
||||||
*/
|
*/
|
||||||
public ExcelWriter(final File destFile) {
|
public ExcelWriter(final File templateFile) {
|
||||||
this(destFile, null);
|
this(templateFile, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 构造
|
* 构造
|
||||||
*
|
*
|
||||||
* @param targetFile 目标文件,可以不存在
|
* @param templateFile 模板文件,不存在则默认为目标写出文件
|
||||||
* @param sheetName sheet名,做为第一个sheet名并写出到此sheet,例如sheet1
|
* @param sheetName sheet名,做为第一个sheet名并写出到此sheet,例如sheet1
|
||||||
*/
|
*/
|
||||||
public ExcelWriter(final File targetFile, final String sheetName) {
|
public ExcelWriter(final File templateFile, final String sheetName) {
|
||||||
this(WorkbookUtil.createBookForWriter(targetFile), sheetName);
|
this(WorkbookUtil.createBookForWriter(templateFile), sheetName);
|
||||||
|
|
||||||
if (!FileUtil.exists(targetFile)) {
|
if (!FileUtil.exists(templateFile)) {
|
||||||
this.targetFile = targetFile;
|
this.targetFile = templateFile;
|
||||||
} else {
|
} else {
|
||||||
// 如果是已经存在的文件,则作为模板加载,此时不能写出到模板文件
|
// 如果是已经存在的文件,则作为模板加载,此时不能写出到模板文件
|
||||||
// 初始化模板
|
// 初始化模板
|
||||||
@ -151,11 +151,11 @@ public class ExcelWriter extends ExcelBase<ExcelWriter, ExcelWriteConfig> {
|
|||||||
* 此构造不传入写出的Excel文件路径,只能调用{@link #flush(OutputStream)}方法写出到流<br>
|
* 此构造不传入写出的Excel文件路径,只能调用{@link #flush(OutputStream)}方法写出到流<br>
|
||||||
* 若写出到文件,还需调用{@link #setTargetFile(File)}方法自定义写出的文件,然后调用{@link #flush()}方法写出到文件
|
* 若写出到文件,还需调用{@link #setTargetFile(File)}方法自定义写出的文件,然后调用{@link #flush()}方法写出到文件
|
||||||
*
|
*
|
||||||
* @param workbook {@link Workbook}
|
* @param templateWorkbook 模板{@link Workbook}
|
||||||
* @param sheetName sheet名,做为第一个sheet名并写出到此sheet,例如sheet1
|
* @param sheetName sheet名,做为第一个sheet名并写出到此sheet,例如sheet1
|
||||||
*/
|
*/
|
||||||
public ExcelWriter(final Workbook workbook, final String sheetName) {
|
public ExcelWriter(final Workbook templateWorkbook, final String sheetName) {
|
||||||
this(SheetUtil.getOrCreateSheet(workbook, sheetName));
|
this(SheetUtil.getOrCreateSheet(templateWorkbook, sheetName));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user