add contenttype

This commit is contained in:
Looly 2021-06-08 12:13:35 +08:00
parent 80e0bbbbc1
commit 7c38e496f4
3 changed files with 59 additions and 53 deletions

View File

@ -3,7 +3,7 @@
-------------------------------------------------------------------------------------------------------------
# 5.6.7 (2021-06-07)
# 5.6.7 (2021-06-08)
### 🐣新特性
* 【core 】 CharSequenceUtil增加join重载issue#I3TFJ5@Gitee
@ -13,6 +13,7 @@
* 【core 】 CsvConfig的setXXX返回thisissue#I3UIQF@Gitee
* 【all 】 增加jmh基准测试
* 【core 】 增加StreamUtil和CollectorUtil
* 【poi 】 增加content-type(pr#1639@Github)
### 🐞Bug修复
* 【core 】 修复FileUtil.normalize去掉末尾空格问题issue#1603@Github

View File

@ -21,21 +21,21 @@ import java.io.InputStream;
* Excel工具类,不建议直接使用index直接操作sheet在wps/excel中sheet显示顺序与index无关还有隐藏sheet
*
* @author Looly
*
*/
public class ExcelUtil {
/**
* xlx的ContentType
*/
public static final String XLS_CONTENT_TYPE = "application/vnd.ms-excel;charset=utf-8";
public static final String XLS_CONTENT_TYPE = "application/vnd.ms-excel";
/**
* xlsx的ContentType
*/
public static final String XLSX_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8";
public static final String XLSX_CONTENT_TYPE = "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
// ------------------------------------------------------------------------------------ Read by Sax start
/**
* 通过Sax方式读取Excel同时支持03和07格式
*
@ -230,6 +230,7 @@ public class ExcelUtil {
// ------------------------------------------------------------------------------------ Read by Sax end
// ------------------------------------------------------------------------------------------------ getReader
/**
* 获取Excel读取器通过调用{@link ExcelReader}的read或readXXX方法读取Excel内容<br>
* 默认调用第一个sheet
@ -397,6 +398,7 @@ public class ExcelUtil {
}
// ------------------------------------------------------------------------------------------------ getWriter
/**
* 获得{@link ExcelWriter}默认写出到第一个sheet<br>
* 不传入写出的Excel文件路径只能调用ExcelWriter#flush(OutputStream)方法写出到流<br>
@ -504,6 +506,7 @@ public class ExcelUtil {
}
// ------------------------------------------------------------------------------------------------ getBigWriter
/**
* 获得{@link BigExcelWriter}默认写出到第一个sheet<br>
* 不传入写出的Excel文件路径只能调用ExcelWriter#flush(OutputStream)方法写出到流<br>

View File

@ -390,6 +390,7 @@ public class ExcelWriter extends ExcelBase<ExcelWriter> {
* </pre>
*
* @return Content-Type值
* @since 5.6.7
*/
public String getContentType() {
return isXlsx() ? ExcelUtil.XLSX_CONTENT_TYPE : ExcelUtil.XLS_CONTENT_TYPE;
@ -408,6 +409,7 @@ public class ExcelWriter extends ExcelBase<ExcelWriter> {
/**
* 定位到最后一行的后边用于追加数据
*
* @return this
* @since 5.5.0
*/