Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
K
know-base
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
张京坤
know-base
Commits
b662d533
提交
b662d533
authored
1月 19, 2024
作者:
ZhangJingKun
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
换word解析jar包 zhangjingkun
上级
cf818d6e
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
63 行增加
和
53 行删除
+63
-53
aspose-words-18.6-jdk16-crack.jar
lib/aspose-words-18.6-jdk16-crack.jar
+0
-0
pom.xml
pom.xml
+16
-7
DocUtil.java
src/main/java/com/zzsn/knowbase/util/DocUtil.java
+47
-46
没有找到文件。
lib/aspose-words-18.6-jdk16-crack.jar
0 → 100644
浏览文件 @
b662d533
File added
pom.xml
浏览文件 @
b662d533
...
...
@@ -184,13 +184,22 @@
<artifactId>
spring-boot-starter-thymeleaf
</artifactId>
</dependency>
<!--word-html处理工具-->
<dependency>
<groupId>
com.aspose
</groupId>
<artifactId>
aspose-words
</artifactId>
<version>
15.12.0
</version>
<scope>
system
</scope>
<systemPath>
${basedir}/lib/aspose-words-15.12.0-jdk16.jar
</systemPath>
</dependency>
<!-- <dependency>-->
<!-- <groupId>com.aspose</groupId>-->
<!-- <artifactId>aspose-words</artifactId>-->
<!-- <version>15.12.0</version>-->
<!-- <scope>system</scope>-->
<!-- <systemPath>${basedir}/lib/aspose-words-15.12.0-jdk16.jar</systemPath>-->
<!-- </dependency>-->
<dependency>
<groupId>
com.aspose
</groupId>
<artifactId>
aspose-words
</artifactId>
<version>
18.6
</version>
<scope>
system
</scope>
<systemPath>
${basedir}/lib/aspose-words-18.6-jdk16-crack.jar
</systemPath>
</dependency>
<dependency>
<groupId>
org.fusesource.hawtbuf
</groupId>
<artifactId>
hawtbuf
</artifactId>
...
...
src/main/java/com/zzsn/knowbase/util/DocUtil.java
浏览文件 @
b662d533
...
...
@@ -139,20 +139,21 @@ public class DocUtil {
* @throws Exception
*/
public
static
byte
[]
convertDocHtml2Doc
(
String
content
,
Boolean
isPage
)
throws
Exception
{
getLicense
();
if
(
SystemUtils
.
IS_OS_LINUX
)
{
logger
.
info
(
"doc set font folder"
);
FontSettings
.
setFontsFolder
(
fontsPath
,
false
);
}
Document
doc
=
new
Document
();
DataByteArrayOutputStream
dataByteArrayOutputStream
=
new
DataByteArrayOutputStream
();
DocumentBuilder
builder
=
new
DocumentBuilder
(
doc
);
if
(!
isPage
)
content
=
convertDocHtml2Page
(
content
);
builder
.
insertHtml
(
content
);
doc
.
save
(
dataByteArrayOutputStream
,
SaveFormat
.
DOCX
);
return
dataByteArrayOutputStream
.
getData
();
// getLicense();
// if (SystemUtils.IS_OS_LINUX) {
// logger.info("doc set font folder");
// FontSettings.setFontsFolder(fontsPath, false);
// }
// Document doc = new Document();
// DataByteArrayOutputStream dataByteArrayOutputStream = new DataByteArrayOutputStream();
// DocumentBuilder builder = new DocumentBuilder(doc);
// if (!isPage)
// content = convertDocHtml2Page(content);
// builder.insertHtml(content);
// doc.save(dataByteArrayOutputStream, SaveFormat.DOCX);
//
// return dataByteArrayOutputStream.getData();
return
null
;
}
/**
...
...
@@ -160,39 +161,39 @@ public class DocUtil {
* @return
* @throws Exception
*/
public
static
byte
[]
convertDocHtml2Png
(
String
content
,
Boolean
isPage
)
throws
Exception
{
getLicense
();
if
(
SystemUtils
.
IS_OS_LINUX
)
{
logger
.
info
(
"cover png set font folder"
);
FontSettings
.
setFontsFolder
(
fontsPath
,
false
);
}
Document
doc
=
new
Document
();
DataByteArrayOutputStream
dataByteArrayOutputStream
=
new
DataByteArrayOutputStream
();
DocumentBuilder
builder
=
new
DocumentBuilder
(
doc
);
if
(!
isPage
)
content
=
convertDocHtml2Page
(
content
);
builder
.
insertHtml
(
content
);
doc
.
save
(
dataByteArrayOutputStream
,
SaveFormat
.
PNG
);
return
dataByteArrayOutputStream
.
getData
();
}
public
static
byte
[]
convertDocHtml2Pdf
(
String
content
,
boolean
isPage
)
throws
Exception
{
getLicense
();
if
(
SystemUtils
.
IS_OS_LINUX
)
{
logger
.
info
(
"pdf set font folder"
);
FontSettings
.
setFontsFolder
(
fontsPath
,
false
);
}
Document
doc
=
new
Document
();
DataByteArrayOutputStream
dataByteArrayOutputStream
=
new
DataByteArrayOutputStream
();
DocumentBuilder
builder
=
new
DocumentBuilder
(
doc
);
if
(!
isPage
)
content
=
convertDocHtml2Page
(
content
);
builder
.
insertHtml
(
content
);
doc
.
save
(
dataByteArrayOutputStream
,
SaveFormat
.
PDF
);
// public static byte[] convertDocHtml2Png(String content, Boolean isPage) throws Exception {
// getLicense();
// if (SystemUtils.IS_OS_LINUX) {
// logger.info("cover png set font folder");
// FontSettings.setFontsFolder(fontsPath, false);
// }
// Document doc = new Document();
// DataByteArrayOutputStream dataByteArrayOutputStream = new DataByteArrayOutputStream();
// DocumentBuilder builder = new DocumentBuilder(doc);
// if (!isPage)
// content = convertDocHtml2Page(content);
// builder.insertHtml(content);
// doc.save(dataByteArrayOutputStream, SaveFormat.PNG);
//
// return dataByteArrayOutputStream.getData();
// }
return
dataByteArrayOutputStream
.
getData
();
}
// public static byte[] convertDocHtml2Pdf(String content, boolean isPage) throws Exception {
// getLicense();
// if (SystemUtils.IS_OS_LINUX) {
// logger.info("pdf set font folder");
// FontSettings.setFontsFolder(fontsPath, false);
// }
// Document doc = new Document();
// DataByteArrayOutputStream dataByteArrayOutputStream = new DataByteArrayOutputStream();
// DocumentBuilder builder = new DocumentBuilder(doc);
// if (!isPage)
// content = convertDocHtml2Page(content);
// builder.insertHtml(content);
// doc.save(dataByteArrayOutputStream, SaveFormat.PDF);
//
// return dataByteArrayOutputStream.getData();
// }
/**
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论