diff --git a/easypoi-base/src/main/java/cn/afterturn/easypoi/cache/manager/FileLoaderImpl.java b/easypoi-base/src/main/java/cn/afterturn/easypoi/cache/manager/FileLoaderImpl.java index c8a684e..f7edb89 100644 --- a/easypoi-base/src/main/java/cn/afterturn/easypoi/cache/manager/FileLoaderImpl.java +++ b/easypoi-base/src/main/java/cn/afterturn/easypoi/cache/manager/FileLoaderImpl.java @@ -1,13 +1,13 @@ /** * Copyright 2013-2015 JueYue (qrb.jueyue@gmail.com) - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software + *
+ * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + *
+ * http://www.apache.org/licenses/LICENSE-2.0 + *
+ * Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
@@ -21,6 +21,8 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.*;
+import java.net.URL;
+import java.net.URLConnection;
/**
* 文件加载类,根据路径加载指定文件
@@ -37,18 +39,30 @@ public class FileLoaderImpl implements IFileLoader {
InputStream fileis = null;
ByteArrayOutputStream baos = null;
try {
- //先用绝对路径查询,再查询相对路径
- try {
- fileis = new FileInputStream(url);
- } catch (FileNotFoundException e) {
- //获取项目文件
- fileis = FileLoaderImpl.class.getClassLoader().getResourceAsStream(url);
- if (fileis == null) {
- //最后再拿相对文件路径
- String path = PoiPublicUtil.getWebRootPath(url);
- fileis = new FileInputStream(path);
+
+ //判断是否是网络地址
+ if (url.startsWith("http")) {
+ URL urlObj = new URL(url);
+ URLConnection urlConnection = urlObj.openConnection();
+ urlConnection.setConnectTimeout(30);
+ urlConnection.setReadTimeout(60);
+ urlConnection.setDoInput(true);
+ fileis = urlConnection.getInputStream();
+ } else {
+ //先用绝对路径查询,再查询相对路径
+ try {
+ fileis = new FileInputStream(url);
+ } catch (FileNotFoundException e) {
+ //获取项目文件
+ fileis = FileLoaderImpl.class.getClassLoader().getResourceAsStream(url);
+ if (fileis == null) {
+ //最后再拿相对文件路径
+ String path = PoiPublicUtil.getWebRootPath(url);
+ fileis = new FileInputStream(path);
+ }
}
}
+
baos = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
int len;
diff --git a/easypoi-base/src/main/java/cn/afterturn/easypoi/excel/entity/ExportParams.java b/easypoi-base/src/main/java/cn/afterturn/easypoi/excel/entity/ExportParams.java
index 9b3acbd..f2e7b6c 100644
--- a/easypoi-base/src/main/java/cn/afterturn/easypoi/excel/entity/ExportParams.java
+++ b/easypoi-base/src/main/java/cn/afterturn/easypoi/excel/entity/ExportParams.java
@@ -83,6 +83,11 @@ public class ExportParams extends ExcelBaseParams {
* Excel 导出style
*/
private Class> style = ExcelExportStylerDefaultImpl.class;
+
+ /**
+ * 表头高度
+ */
+ private double headerHeight = 9D;
/**
* 是否创建表头
*/
@@ -272,4 +277,11 @@ public class ExportParams extends ExcelBaseParams {
this.height = height;
}
+ public short getHeaderHeight() {
+ return (short) (titleHeight * 50);
+ }
+
+ public void setHeaderHeight(double headerHeight) {
+ this.headerHeight = headerHeight;
+ }
}
diff --git a/easypoi-base/src/main/java/cn/afterturn/easypoi/excel/export/ExcelExportService.java b/easypoi-base/src/main/java/cn/afterturn/easypoi/excel/export/ExcelExportService.java
index bb17591..5bfc1a2 100644
--- a/easypoi-base/src/main/java/cn/afterturn/easypoi/excel/export/ExcelExportService.java
+++ b/easypoi-base/src/main/java/cn/afterturn/easypoi/excel/export/ExcelExportService.java
@@ -55,9 +55,9 @@ public class ExcelExportService extends BaseExportService {
List