mirror of
https://github.com/kekingcn/kkFileView.git
synced 2026-04-01 11:56:34 +00:00
Compare commits
124 Commits
0.0.2
...
v2.2.0-SNA
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b1fdbd26a3 | ||
|
|
fa7241bd4e | ||
|
|
8fdf462c6c | ||
|
|
f7c7411bcf | ||
|
|
845cb2e657 | ||
|
|
a4bfde68bd | ||
|
|
19d1ba6cf9 | ||
|
|
1060bdd00f | ||
|
|
8c2fb2bdee | ||
|
|
0fe75387eb | ||
|
|
fbea49e54f | ||
|
|
41a72798d9 | ||
|
|
03cc185085 | ||
|
|
bfbd8ee25e | ||
|
|
f3f36169ff | ||
|
|
2df88544d3 | ||
|
|
6b744d77c7 | ||
|
|
ba57dedebb | ||
|
|
affd5b3057 | ||
|
|
30c3128995 | ||
|
|
b003a05775 | ||
|
|
98ec3d7dab | ||
|
|
69e23dbb99 | ||
|
|
47bda1023a | ||
|
|
fd538a74af | ||
|
|
300d213a7a | ||
|
|
4c0a70f300 | ||
|
|
8798d344b6 | ||
|
|
63e62ab57b | ||
|
|
9a027674ac | ||
|
|
e4407467dd | ||
|
|
551eeb0390 | ||
|
|
11d6ad1ed3 | ||
|
|
e57db6925c | ||
|
|
87096364d8 | ||
|
|
ad8027a7d0 | ||
|
|
9786fa8275 | ||
|
|
37762cf034 | ||
|
|
a78f1e5f8e | ||
|
|
440b8030e0 | ||
|
|
fb7cdfbef7 | ||
|
|
cf1ee9c631 | ||
|
|
13123f8f9d | ||
|
|
189bc3965d | ||
|
|
0aa7444dba | ||
|
|
628efec6bd | ||
|
|
6d0846a551 | ||
|
|
41d9015023 | ||
|
|
3f40b60c64 | ||
|
|
f244054462 | ||
|
|
37fbc98827 | ||
|
|
795cf3393e | ||
|
|
70323b8ee3 | ||
|
|
67686e99f0 | ||
|
|
90554462dc | ||
|
|
ba3084d698 | ||
|
|
3813f75f65 | ||
|
|
a663e99bcd | ||
|
|
d517ab4e6f | ||
|
|
29726c11a3 | ||
|
|
336a18ade7 | ||
|
|
53814fe6ab | ||
|
|
50fb586e6f | ||
|
|
a49ee9d726 | ||
|
|
ae40d0233b | ||
|
|
8f7c13850e | ||
|
|
b4d3419797 | ||
|
|
68aa5db66b | ||
|
|
7e8de7c754 | ||
|
|
f989fbf9c9 | ||
|
|
af8ddc10da | ||
|
|
3713e6e550 | ||
|
|
4a7ba07df1 | ||
|
|
b625381de3 | ||
|
|
0968ac774a | ||
|
|
0db6b23bf7 | ||
|
|
6dc10e8df4 | ||
|
|
9976f0ae99 | ||
|
|
55537d3a25 | ||
|
|
02e116fd8a | ||
|
|
5af3a97720 | ||
|
|
bf08c2c26f | ||
|
|
236ed405f2 | ||
|
|
0fb02e3ccb | ||
|
|
3dd6609fd6 | ||
|
|
dd876792c7 | ||
|
|
3b79ef31e8 | ||
|
|
deb3abcac1 | ||
|
|
1c1a945959 | ||
|
|
d1c5211d03 | ||
|
|
d73bc3a031 | ||
|
|
6f2001b8c9 | ||
|
|
378920b773 | ||
|
|
c78bf0605d | ||
|
|
e8f0efe1ec | ||
|
|
f8ebc4e39b | ||
|
|
3ecea6ee6c | ||
|
|
540e434954 | ||
|
|
6754232a1d | ||
|
|
ad790f4ae9 | ||
|
|
05464bbf1c | ||
|
|
cbe22c259f | ||
|
|
976a071089 | ||
|
|
bb7407542f | ||
|
|
2f86701eea | ||
|
|
5b5388e51f | ||
|
|
02957d98fc | ||
|
|
e3126f3711 | ||
|
|
a04e68c1af | ||
|
|
d4515dfadd | ||
|
|
78de36964d | ||
|
|
dcf37b94db | ||
|
|
73764b027b | ||
|
|
6d621dc05f | ||
|
|
4d6c5501ae | ||
|
|
cd8d1e2ba8 | ||
|
|
4731772d38 | ||
|
|
bc9bb6862b | ||
|
|
4462bab4fa | ||
|
|
6d98c972d1 | ||
|
|
852abadf8f | ||
|
|
2a93f80827 | ||
|
|
a8aef1b97b | ||
|
|
3e5ba7d3ba |
5
.gitignore
vendored
5
.gitignore
vendored
@@ -28,7 +28,6 @@ nbdist/
|
||||
.classpath
|
||||
.project
|
||||
**/.settings
|
||||
**/bin/
|
||||
**/build/
|
||||
**/.externalToolBuilders/
|
||||
*.iml
|
||||
@@ -38,4 +37,6 @@ nbdist/
|
||||
/producer/tmp
|
||||
/.temfile
|
||||
.temfile
|
||||
convertedFile/
|
||||
convertedFile/
|
||||
jodconverter-web/src/main/cache/
|
||||
jodconverter-web/src/main/file/
|
||||
34
Dockerfile
Normal file
34
Dockerfile
Normal file
@@ -0,0 +1,34 @@
|
||||
FROM centos:centos7.6.1810
|
||||
MAINTAINER chenjh "842761733@qq.com"
|
||||
ADD jodconverter-web/target/kkFileView-*.tar.gz /opt/
|
||||
COPY fonts/* /usr/share/fonts/chienes/
|
||||
RUN yum install -y kde-l10n-Chinese &&\
|
||||
yum install -y glibc-common &&\
|
||||
yum install -y fontconfig &&\
|
||||
yum install -y mkfontscale &&\
|
||||
localedef -c -f UTF-8 -i zh_CN zh_CN.utf8 &&\
|
||||
echo "LANG=zh_CN.UTF-8" > /etc/locale.conf &&\
|
||||
source /etc/locale.conf &&\
|
||||
export LANG=zh_CN.UTF-8 &&\
|
||||
LANG="zh_CN.UTF-8" &&\
|
||||
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime &&\
|
||||
yum install -y java-1.8.0-openjdk.x86_64 &&\
|
||||
yum install -y wget &&\
|
||||
yum install -y libXext.x86_64 &&\
|
||||
yum groupinstall -y "X Window System" &&\
|
||||
cd /tmp &&\
|
||||
wget https://iweb.dl.sourceforge.net/project/openofficeorg.mirror/4.1.6/binaries/zh-CN/Apache_OpenOffice_4.1.6_Linux_x86-64_install-rpm_zh-CN.tar.gz -cO openoffice_rpm.tar.gz &&\
|
||||
tar zxf /tmp/openoffice_rpm.tar.gz &&\
|
||||
cd /tmp/zh-CN/RPMS &&\
|
||||
rpm -Uvih *.rpm &&\
|
||||
rpm -Uvih desktop-integration/openoffice4.1.6-redhat-menus-4.1.6-9790.noarch.rpm &&\
|
||||
rm -f /tmp/openoffice_rpm.tar.gz &&\
|
||||
rm -rf /tmp/zh-CN &&\
|
||||
cd /usr/share/fonts/chienes &&\
|
||||
mkfontscale &&\
|
||||
mkfontdir &&\
|
||||
fc-cache -fv
|
||||
ENV LANG zh_CN.UTF-8
|
||||
ENV LC_ALL zh_CN.UTF-8
|
||||
ENV KKFILEVIEW_BIN_FOLDER /opt/kkFileView-2.2.0-SNAPSHOT/bin
|
||||
ENTRYPOINT ["java","-Dfile.encoding=UTF-8","-Dsun.java2d.cmm=sun.java2d.cmm.kcms.KcmsServiceProvider","-Dspring.config.location=/opt/kkFileView-2.2.0-SNAPSHOT/config/application.properties","-jar","/opt/kkFileView-2.2.0-SNAPSHOT/bin/kkFileView-2.2.0-SNAPSHOT.jar"]
|
||||
102
README.en.md
Normal file
102
README.en.md
Normal file
@@ -0,0 +1,102 @@
|
||||
# file-online-preview
|
||||
|
||||
[](https://github.com/kekingcn/kkFileView/blob/master/LICENSE)
|
||||
|
||||
### Introduction
|
||||
|
||||
This kekingcn kkFileView project is intended to be a solution for previewing documents online. At present,there are some similar paid products in the industry.
|
||||
Such as 【[永中office](http://dcs.yozosoft.com/)】,【[office365](http://www.officeweb365.com/)】,【[idocv](https://www.idocv.com/)】, etc...
|
||||
It is an open source implementation and released under the Apache License version 2.0. Finally,It is aimed to feedback the community after obtaining the consent of company executives,
|
||||
special thanks to the supports of @唐老大 and the contributions of @端木详笑.
|
||||
|
||||
### Features
|
||||
- Build with the popular frame spring boot
|
||||
- Easy to build and deploy
|
||||
- Basically support online preview of mainstream office documents, such as Doc, docx, Excel, PDF, TXT, zip, rar, pictures, etc
|
||||
- REST API
|
||||
- Abstract file preview interface so that it is easy to extend more file extensions and develop this project on your own
|
||||
|
||||
### Live demo
|
||||
> Please treat public service kindly, or this would stop at any time.
|
||||
|
||||
URL:http://file.keking.cn/
|
||||
|
||||
### Documentation
|
||||
1. 中文文档:https://gitee.com/kekingcn/file-online-preview/blob/master/README.md
|
||||
1. English document:https://github.com/kekingcn/kkFileView/blob/master/README.en.md
|
||||
|
||||
### Contact us && Join us
|
||||
> We will answer everyone's questions in use of this project.
|
||||
And please Google or Baidu first before asking a question, so that we can solve it efficiently.
|
||||
Cherish life away from ineffective communication.
|
||||
|
||||

|
||||
QQ group:613025121
|
||||
|
||||
### Pictures for some samples
|
||||
> Excel
|
||||
|
||||

|
||||
> doc
|
||||
|
||||

|
||||
|
||||
> zip,rar
|
||||
|
||||

|
||||
|
||||
> png,jpeg,jpg,etc., support for zooming with mouse scroll, rotation, inversion,etc.
|
||||
|
||||

|
||||
Considering space issues, the pictures of other types of documents will not be shown here.You can deploy it by yourself if you are interested in our project.There is a way to deploy it as below.
|
||||
|
||||
### Quick Start
|
||||
> Technology stack
|
||||
- Spring boot: [spring boot Development Reference Guide](http://www.kailing.pub/PdfReader/web/viewer.html?file=springboot)
|
||||
- Freemarker
|
||||
- Redisson
|
||||
- Jodconverter
|
||||
> Dependencies
|
||||
- Redis(Optional, Unnecessary by default)
|
||||
- OpenOffice or LibreOffice(Integrated on Windows, will be installed automatically on Linux, need to be manually installed on Mac OS)
|
||||
|
||||
1. First step:`git pull https://github.com/kekingcn/file-online-preview.git`
|
||||
|
||||
2. Third step:Run the main method of FilePreviewApplication.java.After starting,visit `http://localhost:8012/`.
|
||||
If everything is ok,you will see the picture below.
|
||||

|
||||
|
||||
### Changelog
|
||||
|
||||
> June 18th 2019 :
|
||||
1. Support automatic cleaning of cache and preview files
|
||||
2. Support http/https stream url file preview
|
||||
3. Support FTP url file preview
|
||||
4. Add Docker build
|
||||
|
||||
> April 8th 2019
|
||||
1. Cache and queue implementations abstract, providing JDK and REDIS implementations (REDIS becomes optional dependencies)
|
||||
2. Provides zip and tar.gz packages, and provides a one-click startup script
|
||||
|
||||
> January 17th 2018
|
||||
|
||||
1. Refined the project directory, abstract file preview interface, Easy to extend more file extensions and depoly this project on your own
|
||||
1. Added English documentation (@幻幻Fate,@汝辉) contribution
|
||||
1. Support for more image file extensions
|
||||
1. Fixed the issue that image carousel in zip file will always start from the first
|
||||
|
||||
> January 12th 2018
|
||||
|
||||
1. Support for multiple images preview
|
||||
1. Support for images rotation preview in rar/zip
|
||||
|
||||
> January 2nd 2018
|
||||
|
||||
1. Fixed gibberish issue when preview a txt document caused by the file encoding problem
|
||||
1. Fixed the issue that some module dependencies can not be found
|
||||
1. Add a spring boot profile, and support for Multi-environment configuration
|
||||
1. Add `pdf.js` to preview the documents such as doc,etc.,support for generating doc headlines as pdf menu,support for mobile preview
|
||||
|
||||
### Register Usage
|
||||
If this project is helpful for you, please register on 'https://gitee.com/kekingcn/file-online-preview/issues/IGSBV',
|
||||
If this project helps you to economize the service charge for preview of documents, as well as you are willing to support us, click 【donate】 below to donate a cup of coffee, we would appreciate it.
|
||||
74
README.md
74
README.md
@@ -1,9 +1,25 @@
|
||||
# file-online-preview
|
||||
此项目为文件文档在线预览项目解决方案,对标业内付费产品有【[永中office](http://dcs.yozosoft.com/)】【[office365](http://www.officeweb365.com/)】【[idocv](https://www.idocv.com/)】等,在取得公司高层同意后以Apache协议开源出来反哺社区,在此特别感谢@唐老大的支持以及@端木详笑的贡献。该项目使用流行的spring boot搭建,易上手和部署,基本支持主流办公文档的在线预览,如doc,docx,Excel,pdf,txt,zip,rar,图片等等
|
||||
### 项目特性
|
||||
|
||||
1. 支持office,pdf等办公文档
|
||||
1. 支持txt,java,php,py,md,js,css等所有纯文本
|
||||
1. 支持zip,rar,jar,tar,gzip等压缩包
|
||||
1. 支持jpg,jpeg,png,gif等图片预览(翻转,缩放,镜像)
|
||||
1. 使用spring boot开发,预览服务搭建部署非常简便
|
||||
1. rest接口提供服务,跨平台特性(java,php,python,go,php,....)都支持,应用接入简单方便
|
||||
1. 抽象预览服务接口,方便二次开发,非常方便添加其他类型文件预览支持
|
||||
1. 最最重要Apache协议开源,代码pull下来想干嘛就干嘛
|
||||
|
||||
### 在线体验
|
||||
> 请善待公共服务,会不定时停用
|
||||
|
||||
地址:http://58.246.254.194:8012/
|
||||
地址:http://file.keking.cn/
|
||||
|
||||
### 项目文档(Project documentation)
|
||||
1. 详细wiki文档:https://gitee.com/kekingcn/file-online-preview/wikis/pages
|
||||
1. 中文文档:https://gitee.com/kekingcn/file-online-preview/blob/master/README.md
|
||||
1. English document:https://github.com/kekingcn/kkFileView/blob/master/README.en.md
|
||||
|
||||
### 联系我们,加入组织
|
||||
> 我们会用心回答解决大家在项目使用中的问题,也请大家在提问前至少Google或baidu过,珍爱生命远离无效的交流沟通
|
||||
@@ -35,26 +51,52 @@ QQ群号:613025121
|
||||
- redisson
|
||||
- jodconverter
|
||||
> 依赖外部环境
|
||||
- redis
|
||||
- OpenOffice或者LibreOffice
|
||||
- redis (可选,默认不用)
|
||||
- OpenOffice或者LibreOffice(Windows下已内置,Linux会自动安装,Mac OS下需要手动安装)
|
||||
|
||||
1. 第一步:pull项目https://github.com/kekingcn/file-online-preview.git
|
||||
|
||||
2. 第二步:配置redis地址和OpenOffice目录,如
|
||||
```
|
||||
#=============================================#spring Redisson配置#===================================#
|
||||
spring.redisson.address = 192.168.1.204:6379
|
||||
##资源映射路径(因为jar方式运行的原因)
|
||||
file.dir = C:\\Users\\yudian\\Desktop\\dev\\
|
||||
## openoffice相关配置
|
||||
office.home = C:\\Program Files (x86)\\OpenOffice 4
|
||||
|
||||
```
|
||||
file.dir为转换文件实际存储地址,注意要以/结尾
|
||||
|
||||
3. 第三步:运行FilePreviewApplication的main方法,服务启动后,访问http://localhost:8012/
|
||||
3. 第二步:运行FilePreviewApplication的main方法,服务启动后,访问http://localhost:8012/
|
||||
会看到如下界面,代表服务启动成功
|
||||

|
||||
|
||||
### 历史更新记录
|
||||
|
||||
> 2019年06月18日 :
|
||||
1. 支持自动清理缓存及预览文件
|
||||
2. 支持http/https下载流url文件预览
|
||||
3. 支持FTP url文件预览
|
||||
4. 加入Docker构建
|
||||
|
||||
> 2019年04月08日 :
|
||||
1. 缓存及队列实现抽象,提供JDK和REDIS两种实现(REDIS成为可选依赖)
|
||||
2. 打包方式提供zip和tar.gz包,并提供一键启动脚本
|
||||
|
||||
> 2018年01月19日 :
|
||||
|
||||
1. 大文件入队提前处理
|
||||
1. 新增addTask文件转换入队接口
|
||||
1. 采用redis队列,支持kkFIleView接口和异构系统入队两种方式
|
||||
|
||||
> 2018年01月17日 :
|
||||
|
||||
1. 优化项目结构,抽象文件预览接口,更方便的加入更多的文件类型预览支持,方便二次开发
|
||||
1. 新增英文文档说明(@幻幻Fate,@汝辉)贡献
|
||||
1. 新增图片预览文件支持类型
|
||||
1. 修复压缩包内轮播图片总是从第一张开始的问题
|
||||
|
||||
> 2018年01月12日 :
|
||||
|
||||
1. 新增多图片同时预览
|
||||
1. 支持压缩包内图片轮番预览
|
||||
|
||||
> 2018年01月02日 :
|
||||
|
||||
1. 修复txt等文本编码问题导致预览乱码
|
||||
1. 修复项目模块依赖引入不到的问题
|
||||
1. 新增spring boot profile,支持多环境配置
|
||||
1. 引入pdf.js预览doc等文件,支持doc标题生成pdf预览菜单,支持手机端预览
|
||||
|
||||
### 使用登记
|
||||
如果这个项目解决了你的实际问题,可在https://gitee.com/kekingcn/file-online-preview/issues/IGSBV
|
||||
登记下,如果节省了你的三方预览服务费用,也愿意支持下的话,可点击下方【捐助】请作者喝杯咖啡,也是非常感谢
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>com.yudianbank</groupId>
|
||||
<groupId>cn.keking</groupId>
|
||||
<artifactId>jodconverter-core</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
@@ -12,8 +12,12 @@
|
||||
//
|
||||
package org.artofsolving.jodconverter.office;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.artofsolving.jodconverter.util.PlatformUtils;
|
||||
|
||||
@@ -23,6 +27,8 @@ import com.sun.star.uno.UnoRuntime;
|
||||
public class OfficeUtils {
|
||||
|
||||
public static final String SERVICE_DESKTOP = "com.sun.star.frame.Desktop";
|
||||
public static final String OFFICE_HOME_KEY = "office.home";
|
||||
public static final String DEFAULT_OFFICE_HOME_VALUE = "default";
|
||||
|
||||
private OfficeUtils() {
|
||||
throw new AssertionError("utility class must not be instantiated");
|
||||
@@ -61,29 +67,42 @@ public class OfficeUtils {
|
||||
}
|
||||
|
||||
public static File getDefaultOfficeHome() {
|
||||
if (System.getProperty("office.home") != null) {
|
||||
return new File(System.getProperty("office.home"));
|
||||
Properties properties = new Properties();
|
||||
String customizedConfigPath = getCustomizedConfigPath();
|
||||
try {
|
||||
BufferedReader bufferedReader = new BufferedReader(new FileReader(customizedConfigPath));
|
||||
properties.load(bufferedReader);
|
||||
restorePropertiesFromEnvFormat(properties);
|
||||
} catch (Exception e) {}
|
||||
String officeHome = properties.getProperty(OFFICE_HOME_KEY);
|
||||
if (officeHome != null && !DEFAULT_OFFICE_HOME_VALUE.equals(officeHome)) {
|
||||
return new File(officeHome);
|
||||
}
|
||||
if (PlatformUtils.isWindows()) {
|
||||
// %ProgramFiles(x86)% on 64-bit machines; %ProgramFiles% on 32-bit ones
|
||||
String homePath = OfficeUtils.getHomePath();
|
||||
String programFiles = System.getenv("ProgramFiles(x86)");
|
||||
if (programFiles == null) {
|
||||
programFiles = System.getenv("ProgramFiles");
|
||||
}
|
||||
return findOfficeHome(
|
||||
programFiles + File.separator + "OpenOffice 4",
|
||||
programFiles + File.separator + "LibreOffice 4"
|
||||
programFiles + File.separator + "LibreOffice 4",
|
||||
homePath + File.separator + "office"
|
||||
);
|
||||
} else if (PlatformUtils.isMac()) {
|
||||
return findOfficeHome(
|
||||
"/Applications/OpenOffice.org.app/Contents",
|
||||
"/Applications/OpenOffice.app/Contents",
|
||||
"/Applications/LibreOffice.app/Contents"
|
||||
);
|
||||
} else {
|
||||
// Linux or other *nix variants
|
||||
return findOfficeHome(
|
||||
"/opt/openoffice.org3",
|
||||
"/opt/openoffice",
|
||||
"/opt/libreoffice",
|
||||
"/opt/openoffice4",
|
||||
"/usr/lib/openoffice",
|
||||
"/usr/lib/libreoffice"
|
||||
);
|
||||
@@ -102,10 +121,63 @@ public class OfficeUtils {
|
||||
|
||||
public static File getOfficeExecutable(File officeHome) {
|
||||
if (PlatformUtils.isMac()) {
|
||||
return new File(officeHome, "MacOS/soffice.bin");
|
||||
return new File(officeHome, "MacOS/soffice");
|
||||
} else {
|
||||
return new File(officeHome, "program/soffice.bin");
|
||||
}
|
||||
}
|
||||
|
||||
public static String getHomePath() {
|
||||
String userDir = System.getenv("KKFILEVIEW_BIN_FOLDER");
|
||||
if (userDir == null) {
|
||||
userDir = System.getProperty("user.dir");
|
||||
}
|
||||
if (userDir.endsWith("bin")) {
|
||||
userDir = userDir.substring(0, userDir.length() - 4);
|
||||
} else {
|
||||
String separator = File.separator;
|
||||
if (userDir.contains("jodconverter-web")) {
|
||||
userDir = userDir + separator + "src" + separator + "main";
|
||||
} else {
|
||||
userDir = userDir + separator + "jodconverter-web" + separator + "src" + separator + "main";
|
||||
}
|
||||
}
|
||||
return userDir;
|
||||
}
|
||||
|
||||
public static String getCustomizedConfigPath() {
|
||||
String homePath = OfficeUtils.getHomePath();
|
||||
String separator = java.io.File.separator;
|
||||
String configFilePath = homePath + separator + "config" + separator + "application.properties";
|
||||
return configFilePath;
|
||||
}
|
||||
|
||||
/**
|
||||
* SpringBoot application.properties 支持从环境变量获取值
|
||||
* @param properties
|
||||
*/
|
||||
public synchronized static void restorePropertiesFromEnvFormat(Properties properties) {
|
||||
Iterator<Map.Entry<Object, Object>> iterator = properties.entrySet().iterator();
|
||||
while (iterator.hasNext()) {
|
||||
Map.Entry<Object, Object> entry = iterator.next();
|
||||
String key = entry.getKey().toString();
|
||||
String value = entry.getValue().toString();
|
||||
if (value.trim().startsWith("${") && value.trim().endsWith("}")) {
|
||||
int beginIndex = value.indexOf(":");
|
||||
if (beginIndex < 0) {
|
||||
beginIndex = value.length() - 1;
|
||||
}
|
||||
int endIndex = value.length() - 1;
|
||||
String envKey = value.substring(2, beginIndex);
|
||||
String envValue = System.getenv(envKey);
|
||||
if (envValue == null || "".equals(envValue.trim())) {
|
||||
value = value.substring(beginIndex + 1, endIndex);
|
||||
} else {
|
||||
value = envValue;
|
||||
}
|
||||
properties.setProperty(key, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,7 +10,9 @@
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>jodconverter-web</artifactId>
|
||||
<groupId>cn.keking</groupId>
|
||||
<artifactId>kkFileView</artifactId>
|
||||
<version>2.2.0-SNAPSHOT</version>
|
||||
|
||||
|
||||
<properties>
|
||||
@@ -48,7 +50,7 @@
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.yudianbank</groupId>
|
||||
<groupId>cn.keking</groupId>
|
||||
<artifactId>jodconverter-core</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<exclusions>
|
||||
@@ -104,13 +106,19 @@
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-compress</artifactId>
|
||||
<version>1.9</version>
|
||||
<version>1.18</version>
|
||||
</dependency>
|
||||
<!-- 解压(rar)-->
|
||||
<dependency>
|
||||
<groupId>com.github.junrar</groupId>
|
||||
<artifactId>junrar</artifactId>
|
||||
<version>0.7</version>
|
||||
<version>4.0.0</version>
|
||||
</dependency>
|
||||
<!-- 解压(7z)-->
|
||||
<dependency>
|
||||
<groupId>org.tukaani</groupId>
|
||||
<artifactId>xz</artifactId>
|
||||
<version>1.8</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>net.sourceforge.jchardet</groupId>
|
||||
@@ -139,16 +147,42 @@
|
||||
<artifactId>commons-cli</artifactId>
|
||||
<version>1.2</version>
|
||||
</dependency>
|
||||
<!-- FTP -->
|
||||
<dependency>
|
||||
<groupId>commons-net</groupId>
|
||||
<artifactId>commons-net</artifactId>
|
||||
<version>3.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.thoughtworks.xstream</groupId>
|
||||
<artifactId>xstream</artifactId>
|
||||
<version>1.3.1</version>
|
||||
<version>1.4.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>19.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.googlecode.concurrentlinkedhashmap</groupId>
|
||||
<artifactId>concurrentlinkedhashmap-lru</artifactId>
|
||||
<version>1.4.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.rocksdb</groupId>
|
||||
<artifactId>rocksdbjni</artifactId>
|
||||
<version>5.17.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.pdfbox</groupId>
|
||||
<artifactId>pdfbox</artifactId>
|
||||
<version>2.0.15</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.pdfbox</groupId>
|
||||
<artifactId>pdfbox-tools</artifactId>
|
||||
<version>2.0.15</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<resources>
|
||||
@@ -159,12 +193,36 @@
|
||||
</includes>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
<resource>
|
||||
<directory>src/main/config</directory>
|
||||
<excludes>
|
||||
<exclude>${build.exclude.resource}</exclude>
|
||||
</excludes>
|
||||
</resource>
|
||||
</resources>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<configuration>
|
||||
<appendAssemblyId>false</appendAssemblyId>
|
||||
<descriptors>
|
||||
<descriptor>src/main/assembly/assembly.xml</descriptor>
|
||||
</descriptors>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>make-assembly</id>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>single</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
49
jodconverter-web/src/main/assembly/assembly.xml
Normal file
49
jodconverter-web/src/main/assembly/assembly.xml
Normal file
@@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<assembly
|
||||
xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/2.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/2.0.0 http://maven.apache.org/xsd/assembly-2.0.0.xsd">
|
||||
<id>make-assembly</id>
|
||||
<formats>
|
||||
<format>zip</format>
|
||||
<format>tar.gz</format>
|
||||
</formats>
|
||||
<includeBaseDirectory>true</includeBaseDirectory>
|
||||
<fileSets>
|
||||
<fileSet>
|
||||
<directory>src/main/bin</directory>
|
||||
<outputDirectory>${file.separator}bin</outputDirectory>
|
||||
<includes>
|
||||
<include>*.sh</include>
|
||||
</includes>
|
||||
<fileMode>755</fileMode>
|
||||
<lineEnding>unix</lineEnding>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>src/main/bin</directory>
|
||||
<outputDirectory>${file.separator}bin</outputDirectory>
|
||||
<includes>
|
||||
<include>*.bat</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>src/main/config</directory>
|
||||
<outputDirectory>${file.separator}config</outputDirectory>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>src/main/log</directory>
|
||||
<outputDirectory>${file.separator}log</outputDirectory>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>src/main/office</directory>
|
||||
<outputDirectory>${file.separator}office</outputDirectory>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>${project.build.directory}</directory>
|
||||
<outputDirectory>${file.separator}bin</outputDirectory>
|
||||
<includes>
|
||||
<include>*.jar</include>
|
||||
</includes>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
</assembly>
|
||||
36
jodconverter-web/src/main/bin/install.sh
Normal file
36
jodconverter-web/src/main/bin/install.sh
Normal file
@@ -0,0 +1,36 @@
|
||||
#!/bin/bash
|
||||
cd /tmp
|
||||
|
||||
install_redhat() {
|
||||
wget https://iweb.dl.sourceforge.net/project/openofficeorg.mirror/4.1.6/binaries/zh-CN/Apache_OpenOffice_4.1.6_Linux_x86-64_install-rpm_zh-CN.tar.gz -cO openoffice_rpm.tar.gz && tar zxf /tmp/openoffice_rpm.tar.gz && cd /tmp/zh-CN/RPMS
|
||||
if [ $? -eq 0 ];then
|
||||
rpm -Uvih *.rpm
|
||||
echo 'install desktop service ...'
|
||||
rpm -Uvih desktop-integration/openoffice4.1.6-redhat-menus-4.1.6-9790.noarch.rpm
|
||||
echo 'install finshed...'
|
||||
else
|
||||
echo 'download package error...'
|
||||
fi
|
||||
}
|
||||
|
||||
install_ubuntu() {
|
||||
wget https://iweb.dl.sourceforge.net/project/openofficeorg.mirror/4.1.6/binaries/zh-CN/Apache_OpenOffice_4.1.6_Linux_x86-64_install-deb_zh-CN.tar.gz -cO openoffice_deb.tar.gz && tar zxf /tmp/openoffice_deb.tar.gz && cd /tmp/zh-CN/DEBS
|
||||
echo $?
|
||||
if [ $? -eq 0 ];then
|
||||
dpkg -i *.deb
|
||||
echo 'install desktop service ...'
|
||||
dpkg -i desktop-integration/openoffice4.1-debian-menus_4.1.6-9790_all.deb
|
||||
echo 'install finshed...'
|
||||
else
|
||||
echo 'download package error...'
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
if [ -f "/etc/redhat-release" ]; then
|
||||
yum install -y wget
|
||||
install_redhat
|
||||
else
|
||||
apt-get install -y wget
|
||||
install_ubuntu
|
||||
fi
|
||||
2
jodconverter-web/src/main/bin/showlog.sh
Normal file
2
jodconverter-web/src/main/bin/showlog.sh
Normal file
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
tail -fn 300 ../log/kkFileView.log
|
||||
2
jodconverter-web/src/main/bin/shutdown.sh
Normal file
2
jodconverter-web/src/main/bin/shutdown.sh
Normal file
@@ -0,0 +1,2 @@
|
||||
#!/bin/bash
|
||||
kill -15 `ps -ef|grep kkFileView|awk 'NR==1{print $2}'`
|
||||
9
jodconverter-web/src/main/bin/startup.bat
Normal file
9
jodconverter-web/src/main/bin/startup.bat
Normal file
@@ -0,0 +1,9 @@
|
||||
@echo off
|
||||
set "KKFILEVIEW_BIN_FOLDER=%cd%"
|
||||
cd "%KKFILEVIEW_BIN_FOLDER%"
|
||||
echo Using KKFILEVIEW_BIN_FOLDER %KKFILEVIEW_BIN_FOLDER%
|
||||
echo Starting kkFileView...
|
||||
echo Please check log file in ../log/kkFileView.log for more information
|
||||
echo You can get help in our official homesite: https://kkFileView.keking.cn
|
||||
echo If this project is helpful to you, please star it on https://gitee.com/kekingcn/file-online-preview/stargazers
|
||||
java -Dsun.java2d.cmm=sun.java2d.cmm.kcms.KcmsServiceProvider -Dspring.config.location=..\config\application.properties -jar kkFileView-2.2.0-SNAPSHOT.jar -> ..\log\kkFileView.log
|
||||
32
jodconverter-web/src/main/bin/startup.sh
Normal file
32
jodconverter-web/src/main/bin/startup.sh
Normal file
@@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
DIR_HOME=("/opt/openoffice.org3" "/opt/libreoffice" "/opt/openoffice4" "/usr/lib/openoffice" "/usr/lib/libreoffice")
|
||||
FLAG=
|
||||
OFFICE_HOME=
|
||||
KKFILEVIEW_BIN_FOLDER=$(cd "$(dirname "$0")";pwd)
|
||||
export KKFILEVIEW_BIN_FOLDER=$KKFILEVIEW_BIN_FOLDER
|
||||
cd $KKFILEVIEW_BIN_FOLDER
|
||||
echo "Using KKFILEVIEW_BIN_FOLDER $KKFILEVIEW_BIN_FOLDER"
|
||||
grep 'office\.home' ../config/application.properties | grep '!^#'
|
||||
if [ $? -eq 0 ]; then
|
||||
echo "Using customized office.home"
|
||||
else
|
||||
for i in ${DIR_HOME[@]}
|
||||
do
|
||||
if [ -f $i"/program/soffice.bin" ]; then
|
||||
FLAG=true
|
||||
OFFICE_HOME=${i}
|
||||
break
|
||||
fi
|
||||
done
|
||||
if [ ! -n "${FLAG}" ]; then
|
||||
echo "Installing OpenOffice"
|
||||
sh ./install.sh
|
||||
else
|
||||
echo "Detected office component has been installed in $OFFICE_HOME"
|
||||
fi
|
||||
fi
|
||||
echo "Starting kkFileView..."
|
||||
echo "Please execute ./showlog.sh to check log for more information"
|
||||
echo "You can get help in our official homesite: https://kkFileView.keking.cn"
|
||||
echo "If this project is helpful to you, please star it on https://gitee.com/kekingcn/file-online-preview/stargazers"
|
||||
nohup java -Dfile.encoding=UTF-8 -Dsun.java2d.cmm=sun.java2d.cmm.kcms.KcmsServiceProvider -Dspring.config.location=../config/application.properties -jar kkFileView-2.2.0-SNAPSHOT.jar > ../log/kkFileView.log 2>&1 &
|
||||
57
jodconverter-web/src/main/config/application.properties
Normal file
57
jodconverter-web/src/main/config/application.properties
Normal file
@@ -0,0 +1,57 @@
|
||||
#######################################不可动态配置,需要重启生效#######################################
|
||||
server.port = ${KK_SERVER_PORT:8012}
|
||||
spring.http.encoding.charset = utf8
|
||||
## Freemarker 配置
|
||||
spring.freemarker.template-loader-path = classpath:/web/
|
||||
spring.freemarker.cache = false
|
||||
spring.freemarker.charset = UTF-8
|
||||
spring.freemarker.check-template-location = true
|
||||
spring.freemarker.content-type = text/html
|
||||
spring.freemarker.expose-request-attributes = true
|
||||
spring.freemarker.expose-session-attributes = true
|
||||
spring.freemarker.request-context-attribute = request
|
||||
spring.freemarker.suffix = .ftl
|
||||
|
||||
server.tomcat.uri-encoding = UTF-8
|
||||
#文件上传限制
|
||||
spring.http.multipart.max-request-size=100MB
|
||||
spring.http.multipart.max-file-size=100MB
|
||||
|
||||
#文件资源路径(默认为打包根路径下的file目录下)
|
||||
#file.dir = D:\\kkFileview\\
|
||||
file.dir = ${KK_FILE_DIR:default}
|
||||
#openoffice home路径
|
||||
#office.home = C:\\Program Files (x86)\\OpenOffice 4
|
||||
office.home = ${KK_OFFICE_HOME:default}
|
||||
|
||||
#缓存实现类型,不配默认为内嵌RocksDB(type = default)实现,可配置为redis(type = redis)实现(需要配置spring.redisson.address等参数)和 JDK 内置对象实现(type = jdk),
|
||||
cache.type = ${KK_CACHE_TYPE:default}
|
||||
#redis连接,只有当cache.type = redis时才有用
|
||||
spring.redisson.address = ${KK_SPRING_REDISSON_ADDRESS:127.0.0.1:6379}
|
||||
spring.redisson.password = ${KK_SPRING_REDISSON_PASSWORD:123456}
|
||||
#缓存是否自动清理 true 为开启,注释掉或其他值都为关闭
|
||||
cache.clean.enabled = ${KK_CACHE_CLEAN_ENABLED:true}
|
||||
#缓存自动清理时间,cache.clean.enabled = true时才有用,cron表达式,基于Quartz cron
|
||||
cache.clean.cron = ${KK_CACHE_CLEAN_CRON:0 0 3 * * ?}
|
||||
|
||||
#######################################可在运行时动态配置#######################################
|
||||
#提供预览服务的地址,默认从请求url读,如果使用nginx等反向代理,需要手动设置
|
||||
#base.url = https://file.keking.cn
|
||||
base.url = ${KK_BASE_URL:default}
|
||||
|
||||
#是否启用缓存
|
||||
cache.enabled = ${KK_CACHE_ENABLED:true}
|
||||
|
||||
#文本类型,默认如下,可自定义添加
|
||||
simText = ${KK_SIMTEXT:txt,html,htm,asp,jsp,xml,json,properties,md,gitignore,,java,py,c,cpp,sql,sh,bat,m,bas,prg,cmd}
|
||||
#多媒体类型,默认如下,可自定义添加
|
||||
media = ${KK_MEDIA:mp3,wav,mp4,flv}
|
||||
#office类型文档(word ppt)样式,默认为图片(image),可配置为pdf(预览时也有按钮切换)
|
||||
office.preview.type = ${KK_OFFICE_PREVIEW_TYPE:image}
|
||||
|
||||
#预览源为FTP时 FTP用户名,可在ftp url后面加参数ftp.username=ftpuser指定,不指定默认用配置的
|
||||
ftp.username = ${KK_FTP_USERNAME:ftpuser}
|
||||
#预览源为FTP时 FTP密码,可在ftp url后面加参数ftp.password=123456指定,不指定默认用配置的
|
||||
ftp.password = ${KK_FTP_PASSWORD:123456}
|
||||
#预览源为FTP时, FTP连接默认ControlEncoding(根据FTP服务器操作系统选择,Linux一般为UTF-8,Windows一般为GBK),可在ftp url后面加参数ftp.control.encoding=UTF-8指定,不指定默认用配置的
|
||||
ftp.control.encoding = ${KK_FTP_CONTROL_ENCODING:UTF-8}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.yudianbank;
|
||||
package cn.keking;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
@@ -8,7 +8,7 @@ import java.util.Properties;
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableScheduling
|
||||
@ComponentScan(value = "com.yudianbank.*")
|
||||
@ComponentScan(value = "cn.keking.*")
|
||||
public class FilePreviewApplication {
|
||||
public static void main(String[] args) {
|
||||
Properties properties = System.getProperties();
|
||||
@@ -0,0 +1,107 @@
|
||||
package cn.keking.config;
|
||||
|
||||
import org.artofsolving.jodconverter.office.OfficeUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* @auther: chenjh
|
||||
* @time: 2019/4/10 17:22
|
||||
* @description
|
||||
*/
|
||||
@Component
|
||||
public class ConfigConstants {
|
||||
|
||||
private static Boolean cacheEnabled;
|
||||
private static String[] simText = {};
|
||||
private static String[] media = {};
|
||||
private static String officePreviewType;
|
||||
private static String ftpUsername;
|
||||
private static String ftpPassword;
|
||||
private static String ftpControlEncoding;
|
||||
private static String fileDir = OfficeUtils.getHomePath() + File.separator + "file" + File.separator;
|
||||
private static String baseUrl;
|
||||
|
||||
public static final String DEFAULT_FILE_DIR_VALUE = "default";
|
||||
|
||||
public static Boolean isCacheEnabled() {
|
||||
return cacheEnabled;
|
||||
}
|
||||
|
||||
public static void setCacheEnabled(Boolean cacheEnabled) {
|
||||
ConfigConstants.cacheEnabled = cacheEnabled;
|
||||
}
|
||||
|
||||
public static String[] getSimText() {
|
||||
return simText;
|
||||
}
|
||||
|
||||
public static void setSimText(String[] simText) {
|
||||
ConfigConstants.simText = simText;
|
||||
}
|
||||
|
||||
public static String[] getMedia() {
|
||||
return media;
|
||||
}
|
||||
|
||||
public static void setMedia(String[] media) {
|
||||
ConfigConstants.media = media;
|
||||
}
|
||||
|
||||
public static String getOfficePreviewType() {
|
||||
return officePreviewType;
|
||||
}
|
||||
|
||||
public static void setOfficePreviewType(String officePreviewType) {
|
||||
ConfigConstants.officePreviewType = officePreviewType;
|
||||
}
|
||||
|
||||
public static String getFtpUsername() {
|
||||
return ftpUsername;
|
||||
}
|
||||
|
||||
public static void setFtpUsername(String ftpUsername) {
|
||||
ConfigConstants.ftpUsername = ftpUsername;
|
||||
}
|
||||
|
||||
public static String getFtpPassword() {
|
||||
return ftpPassword;
|
||||
}
|
||||
|
||||
public static String getFtpControlEncoding() {
|
||||
return ftpControlEncoding;
|
||||
}
|
||||
|
||||
public static void setFtpControlEncoding(String ftpControlEncoding) {
|
||||
ConfigConstants.ftpControlEncoding = ftpControlEncoding;
|
||||
}
|
||||
|
||||
public static void setFtpPassword(String ftpPassword) {
|
||||
ConfigConstants.ftpPassword = ftpPassword;
|
||||
}
|
||||
|
||||
public static String getFileDir() {
|
||||
return fileDir;
|
||||
}
|
||||
|
||||
public static String getBaseUrl() {
|
||||
return baseUrl;
|
||||
}
|
||||
|
||||
public static void setBaseUrl(String baseUrl) {
|
||||
ConfigConstants.baseUrl = baseUrl;
|
||||
}
|
||||
|
||||
@Value("${file.dir:default}")
|
||||
public void setFileDir(String fileDir) {
|
||||
if (!DEFAULT_FILE_DIR_VALUE.equals(fileDir.toLowerCase())) {
|
||||
if (!fileDir.endsWith(File.separator)) {
|
||||
fileDir = fileDir + File.separator;
|
||||
}
|
||||
ConfigConstants.fileDir = fileDir;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package cn.keking.config;
|
||||
|
||||
import cn.keking.service.impl.OfficeFilePreviewImpl;
|
||||
import org.artofsolving.jodconverter.office.OfficeUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* @auther: chenjh
|
||||
* @time: 2019/4/10 16:16
|
||||
* @description 每隔1s读取并更新一次配置文件
|
||||
*/
|
||||
@Component
|
||||
public class ConfigRefreshComponent {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ConfigRefreshComponent.class);
|
||||
|
||||
public static final String DEFAULT_CACHE_ENABLED = "true";
|
||||
public static final String DEFAULT_TXT_TYPE = "txt,html,htm,asp,jsp,xml,json,properties,md,gitignore,,java,py,c,cpp,sql,sh,bat,m,bas,prg,cmd";
|
||||
public static final String DEFAULT_MEDIA_TYPE = "mp3,wav,mp4,flv";
|
||||
|
||||
public static final String DEFAULT_FTP_USERNAME = null;
|
||||
public static final String DEFAULT_FTP_PASSWORD = null;
|
||||
public static final String DEFAULT_FTP_CONTROL_ENCODING = "UTF-8";
|
||||
public static final String DEFAULT_BASE_URL = "default";
|
||||
|
||||
@PostConstruct
|
||||
void refresh() {
|
||||
Thread configRefreshThread = new Thread(new ConfigRefreshThread());
|
||||
configRefreshThread.start();
|
||||
}
|
||||
|
||||
class ConfigRefreshThread implements Runnable {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Properties properties = new Properties();
|
||||
String text;
|
||||
String media;
|
||||
Boolean cacheEnabled;
|
||||
String[] textArray;
|
||||
String[] mediaArray;
|
||||
String officePreviewType;
|
||||
String ftpUsername;
|
||||
String ftpPassword;
|
||||
String ftpControlEncoding;
|
||||
String configFilePath = OfficeUtils.getCustomizedConfigPath();
|
||||
String baseUlr;
|
||||
while (true) {
|
||||
FileReader fileReader = new FileReader(configFilePath);
|
||||
BufferedReader bufferedReader = new BufferedReader(fileReader);
|
||||
properties.load(bufferedReader);
|
||||
OfficeUtils.restorePropertiesFromEnvFormat(properties);
|
||||
cacheEnabled = new Boolean(properties.getProperty("cache.enabled", DEFAULT_CACHE_ENABLED));
|
||||
text = properties.getProperty("simText", DEFAULT_TXT_TYPE);
|
||||
media = properties.getProperty("media", DEFAULT_MEDIA_TYPE);
|
||||
officePreviewType = properties.getProperty("office.preview.type", OfficeFilePreviewImpl.OFFICE_PREVIEW_TYPE_IMAGE);
|
||||
ftpUsername = properties.getProperty("ftp.username", DEFAULT_FTP_USERNAME);
|
||||
ftpPassword = properties.getProperty("ftp.password", DEFAULT_FTP_PASSWORD);
|
||||
ftpControlEncoding = properties.getProperty("ftp.control.encoding", DEFAULT_FTP_CONTROL_ENCODING);
|
||||
textArray = text.split(",");
|
||||
mediaArray = media.split(",");
|
||||
baseUlr = properties.getProperty("base.url", DEFAULT_BASE_URL);
|
||||
ConfigConstants.setCacheEnabled(cacheEnabled);
|
||||
ConfigConstants.setSimText(textArray);
|
||||
ConfigConstants.setMedia(mediaArray);
|
||||
ConfigConstants.setOfficePreviewType(officePreviewType);
|
||||
ConfigConstants.setFtpUsername(ftpUsername);
|
||||
ConfigConstants.setFtpPassword(ftpPassword);
|
||||
ConfigConstants.setFtpControlEncoding(ftpControlEncoding);
|
||||
ConfigConstants.setBaseUrl(baseUlr);
|
||||
bufferedReader.close();
|
||||
fileReader.close();
|
||||
Thread.sleep(1000L);
|
||||
}
|
||||
} catch (IOException | InterruptedException e) {
|
||||
LOGGER.error("读取配置文件异常", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,9 @@
|
||||
package com.yudianbank.config;
|
||||
package cn.keking.config;
|
||||
|
||||
import io.netty.channel.nio.NioEventLoopGroup;
|
||||
import org.redisson.Redisson;
|
||||
import org.redisson.api.RedissonClient;
|
||||
import org.redisson.client.codec.Codec;
|
||||
import org.redisson.config.Config;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
@@ -14,6 +13,7 @@ import org.springframework.util.ClassUtils;
|
||||
* Created by kl on 2017/09/26.
|
||||
* redisson 客户端配置
|
||||
*/
|
||||
@ConditionalOnExpression("'${cache.type:default}'.equals('redis')")
|
||||
@ConfigurationProperties(prefix = "spring.redisson")
|
||||
@Configuration
|
||||
public class RedissonConfig {
|
||||
@@ -42,8 +42,8 @@ public class RedissonConfig {
|
||||
|
||||
private String codec="org.redisson.codec.JsonJacksonCodec";
|
||||
|
||||
@Bean(destroyMethod = "shutdown")
|
||||
RedissonClient redisson() throws Exception {
|
||||
@Bean
|
||||
Config config() throws Exception {
|
||||
Config config = new Config();
|
||||
config.useSingleServer().setAddress(address)
|
||||
.setConnectionMinimumIdleSize(connectionMinimumIdleSize)
|
||||
@@ -69,7 +69,7 @@ public class RedissonConfig {
|
||||
config.setThreads(thread);
|
||||
config.setEventLoopGroup(new NioEventLoopGroup());
|
||||
config.setUseLinuxNativeEpoll(false);
|
||||
return Redisson.create(config);
|
||||
return config;
|
||||
}
|
||||
|
||||
public int getThread() {
|
||||
@@ -0,0 +1,28 @@
|
||||
package cn.keking.config;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
||||
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
|
||||
|
||||
/**
|
||||
* @auther: chenjh
|
||||
* @time: 2019/4/16 20:04
|
||||
* @description
|
||||
*/
|
||||
@Configuration
|
||||
public class WebConfig extends WebMvcConfigurerAdapter {
|
||||
|
||||
private final static Logger LOGGER = LoggerFactory.getLogger(WebConfig.class);
|
||||
/**
|
||||
* 访问外部文件配置
|
||||
*/
|
||||
@Override
|
||||
public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
||||
String filePath = ConfigConstants.getFileDir();
|
||||
LOGGER.info("Add resource locations: {}", filePath);
|
||||
registry.addResourceHandler("/**").addResourceLocations("classpath:/META-INF/resources/","classpath:/resources/","classpath:/static/","classpath:/public/","file:" + filePath);
|
||||
super.addResourceHandlers(registry);
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.yudianbank.extend;
|
||||
package cn.keking.extend;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.sun.star.beans.PropertyValue;
|
||||
@@ -0,0 +1,46 @@
|
||||
package cn.keking.filters;
|
||||
|
||||
import cn.keking.config.ConfigConstants;
|
||||
import cn.keking.config.ConfigRefreshComponent;
|
||||
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author yudian-it
|
||||
* @date 2017/11/30
|
||||
*/
|
||||
public class ChinesePathFilter implements Filter {
|
||||
|
||||
@Override
|
||||
public void init(FilterConfig filterConfig) throws ServletException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
|
||||
request.setCharacterEncoding("UTF-8");
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
String baseUrl;
|
||||
String baseUrlTmp = ConfigConstants.getBaseUrl();
|
||||
if (baseUrlTmp != null && !ConfigRefreshComponent.DEFAULT_BASE_URL.equals(baseUrlTmp.toLowerCase())) {
|
||||
if (!baseUrlTmp.endsWith("/")) {
|
||||
baseUrlTmp = baseUrlTmp.concat("/");
|
||||
}
|
||||
baseUrl = baseUrlTmp;
|
||||
} else {
|
||||
StringBuilder pathBuilder = new StringBuilder();
|
||||
pathBuilder.append(request.getScheme()).append("://").append(request.getServerName()).append(":")
|
||||
.append(request.getServerPort()).append(((HttpServletRequest) request).getContextPath()).append("/");
|
||||
baseUrl = pathBuilder.toString();
|
||||
}
|
||||
request.setAttribute("baseUrl", baseUrl);
|
||||
chain.doFilter(request, response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.yudianbank.filters;
|
||||
package cn.keking.filters;
|
||||
|
||||
import org.springframework.boot.web.servlet.FilterRegistrationBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
@@ -0,0 +1,69 @@
|
||||
package cn.keking.model;
|
||||
|
||||
/**
|
||||
* Created by kl on 2018/1/17.
|
||||
* Content :
|
||||
*/
|
||||
public class FileAttribute {
|
||||
|
||||
private FileType type;
|
||||
|
||||
private String suffix;
|
||||
|
||||
private String name;
|
||||
|
||||
private String url;
|
||||
|
||||
private String decodedUrl;
|
||||
|
||||
public FileAttribute() {
|
||||
}
|
||||
|
||||
public FileAttribute(FileType type, String suffix, String name, String url, String decodedUrl) {
|
||||
this.type = type;
|
||||
this.suffix = suffix;
|
||||
this.name = name;
|
||||
this.url = url;
|
||||
this.decodedUrl = decodedUrl;
|
||||
}
|
||||
|
||||
public FileType getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(FileType type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getSuffix() {
|
||||
return suffix;
|
||||
}
|
||||
|
||||
public void setSuffix(String suffix) {
|
||||
this.suffix = suffix;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getUrl() {
|
||||
return url;
|
||||
}
|
||||
|
||||
public void setUrl(String url) {
|
||||
this.url = url;
|
||||
}
|
||||
|
||||
public String getDecodedUrl() {
|
||||
return decodedUrl;
|
||||
}
|
||||
|
||||
public void setDecodedUrl(String decodedUrl) {
|
||||
this.decodedUrl = decodedUrl;
|
||||
}
|
||||
}
|
||||
28
jodconverter-web/src/main/java/cn/keking/model/FileType.java
Normal file
28
jodconverter-web/src/main/java/cn/keking/model/FileType.java
Normal file
@@ -0,0 +1,28 @@
|
||||
package cn.keking.model;
|
||||
|
||||
/**
|
||||
* Created by kl on 2018/1/17.
|
||||
* Content :文件类型,文本,office,压缩包等等
|
||||
*/
|
||||
public enum FileType {
|
||||
picture("pictureFilePreviewImpl"),
|
||||
compress("compressFilePreviewImpl"),
|
||||
office("officeFilePreviewImpl"),
|
||||
simText("simTextFilePreviewImpl"),
|
||||
pdf("pdfFilePreviewImpl"),
|
||||
other("otherFilePreviewImpl"),
|
||||
media("mediaFilePreviewImpl");
|
||||
|
||||
private String instanceName;
|
||||
FileType(String instanceName){
|
||||
this.instanceName=instanceName;
|
||||
}
|
||||
|
||||
public String getInstanceName() {
|
||||
return instanceName;
|
||||
}
|
||||
|
||||
public void setInstanceName(String instanceName) {
|
||||
this.instanceName = instanceName;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.yudianbank.param;
|
||||
package cn.keking.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@@ -0,0 +1,82 @@
|
||||
package cn.keking.service;
|
||||
|
||||
import cn.keking.model.FileAttribute;
|
||||
import cn.keking.model.FileType;
|
||||
import cn.keking.service.cache.CacheService;
|
||||
import cn.keking.utils.FileUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.ui.ExtendedModelMap;
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
/**
|
||||
* Created by kl on 2018/1/19.
|
||||
* Content :消费队列中的转换文件
|
||||
*/
|
||||
@Service
|
||||
public class FileConverQueueTask {
|
||||
|
||||
Logger logger= LoggerFactory.getLogger(getClass());
|
||||
public static final String queueTaskName="FileConverQueueTask";
|
||||
|
||||
@Autowired
|
||||
FilePreviewFactory previewFactory;
|
||||
|
||||
@Autowired
|
||||
CacheService cacheService;
|
||||
|
||||
@Autowired
|
||||
FileUtils fileUtils;
|
||||
|
||||
@PostConstruct
|
||||
public void startTask(){
|
||||
ExecutorService executorService = Executors.newFixedThreadPool(3);
|
||||
executorService.submit(new ConverTask(previewFactory, cacheService, fileUtils));
|
||||
logger.info("队列处理文件转换任务启动完成 ");
|
||||
}
|
||||
|
||||
class ConverTask implements Runnable{
|
||||
|
||||
FilePreviewFactory previewFactory;
|
||||
|
||||
CacheService cacheService;
|
||||
|
||||
FileUtils fileUtils;
|
||||
|
||||
public ConverTask(FilePreviewFactory previewFactory, CacheService cacheService, FileUtils fileUtils) {
|
||||
this.previewFactory = previewFactory;
|
||||
this.cacheService = cacheService;
|
||||
this.fileUtils=fileUtils;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
while (true) {
|
||||
try {
|
||||
String url = cacheService.takeQueueTask();
|
||||
if(url != null){
|
||||
FileAttribute fileAttribute = fileUtils.getFileAttribute(url);
|
||||
logger.info("正在处理转换任务,文件名称【{}】",fileAttribute.getName());
|
||||
FileType fileType=fileAttribute.getType();
|
||||
if(fileType.equals(FileType.compress) || fileType.equals(FileType.office)){
|
||||
FilePreview filePreview=previewFactory.get(fileAttribute);
|
||||
filePreview.filePreviewHandle(url, new ExtendedModelMap(), fileAttribute);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
try {
|
||||
Thread.sleep(1000*10);
|
||||
}catch (Exception ex){
|
||||
ex.printStackTrace();
|
||||
}
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package cn.keking.service;
|
||||
|
||||
import cn.keking.model.FileAttribute;
|
||||
import org.springframework.ui.Model;
|
||||
|
||||
/**
|
||||
* Created by kl on 2018/1/17.
|
||||
* Content :
|
||||
*/
|
||||
public interface FilePreview {
|
||||
String filePreviewHandle(String url, Model model, FileAttribute fileAttribute);
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package cn.keking.service;
|
||||
|
||||
import cn.keking.model.FileAttribute;
|
||||
import cn.keking.utils.FileUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Created by kl on 2018/1/17.
|
||||
* Content :
|
||||
*/
|
||||
@Service
|
||||
public class FilePreviewFactory {
|
||||
|
||||
@Autowired
|
||||
FileUtils fileUtils;
|
||||
|
||||
@Autowired
|
||||
ApplicationContext context;
|
||||
|
||||
public FilePreview get(FileAttribute fileAttribute) {
|
||||
Map<String, FilePreview> filePreviewMap = context.getBeansOfType(FilePreview.class);
|
||||
return filePreviewMap.get(fileAttribute.getType().getInstanceName());
|
||||
}
|
||||
}
|
||||
40
jodconverter-web/src/main/java/cn/keking/service/cache/CacheService.java
vendored
Normal file
40
jodconverter-web/src/main/java/cn/keking/service/cache/CacheService.java
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
package cn.keking.service.cache;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @auther: chenjh
|
||||
* @time: 2019/4/2 16:45
|
||||
* @description
|
||||
*/
|
||||
public interface CacheService {
|
||||
final String REDIS_FILE_PREVIEW_PDF_KEY = "converted-preview-pdf-file";
|
||||
final String REDIS_FILE_PREVIEW_IMGS_KEY = "converted-preview-imgs-file";//压缩包内图片文件集合
|
||||
final String REDIS_FILE_PREVIEW_PDF_IMGS_KEY = "converted-preview-pdfimgs-file";
|
||||
|
||||
|
||||
final Integer DEFAULT_PDF_CAPACITY = 500000;
|
||||
final Integer DEFAULT_IMG_CAPACITY = 500000;
|
||||
final Integer DEFAULT_PDFIMG_CAPACITY = 500000;
|
||||
|
||||
void initPDFCachePool(Integer capacity);
|
||||
void initIMGCachePool(Integer capacity);
|
||||
void initPdfImagesCachePool(Integer capacity);
|
||||
void putPDFCache(String key, String value);
|
||||
void putImgCache(String key, List<String> value);
|
||||
Map<String, String> getPDFCache();
|
||||
String getPDFCache(String key);
|
||||
Map<String, List<String>> getImgCache();
|
||||
List<String> getImgCache(String key);
|
||||
Integer getPdfImageCache(String key);
|
||||
void putPdfImageCache(String pdfFilePath, int num);
|
||||
|
||||
void cleanCache();
|
||||
|
||||
void addQueueTask(String url);
|
||||
String takeQueueTask() throws InterruptedException;
|
||||
|
||||
|
||||
|
||||
}
|
||||
135
jodconverter-web/src/main/java/cn/keking/service/cache/impl/CacheServiceJDKImpl.java
vendored
Normal file
135
jodconverter-web/src/main/java/cn/keking/service/cache/impl/CacheServiceJDKImpl.java
vendored
Normal file
@@ -0,0 +1,135 @@
|
||||
package cn.keking.service.cache.impl;
|
||||
|
||||
import cn.keking.service.cache.CacheService;
|
||||
import com.googlecode.concurrentlinkedhashmap.ConcurrentLinkedHashMap;
|
||||
import com.googlecode.concurrentlinkedhashmap.Weighers;
|
||||
import org.rocksdb.RocksDB;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ArrayBlockingQueue;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
|
||||
/**
|
||||
* @auther: chenjh
|
||||
* @time: 2019/4/2 17:21
|
||||
* @description
|
||||
*/
|
||||
@Service
|
||||
@ConditionalOnExpression("'${cache.type:default}'.equals('jdk')")
|
||||
public class CacheServiceJDKImpl implements CacheService {
|
||||
|
||||
private Map<String, String> pdfCache;
|
||||
|
||||
private Map<String, List<String>> imgCache;
|
||||
|
||||
private Map<String, Integer> pdfImagesCache;
|
||||
|
||||
private static final int QUEUE_SIZE = 500000;
|
||||
|
||||
private BlockingQueue blockingQueue = new ArrayBlockingQueue(QUEUE_SIZE);
|
||||
|
||||
@Override
|
||||
public void initPDFCachePool(Integer capacity) {
|
||||
pdfCache = new ConcurrentLinkedHashMap.Builder<String, String>()
|
||||
.maximumWeightedCapacity(capacity).weigher(Weighers.singleton())
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initIMGCachePool(Integer capacity) {
|
||||
imgCache = new ConcurrentLinkedHashMap.Builder<String, List<String>>()
|
||||
.maximumWeightedCapacity(capacity).weigher(Weighers.singleton())
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initPdfImagesCachePool(Integer capacity) {
|
||||
pdfImagesCache = new ConcurrentLinkedHashMap.Builder<String, Integer>()
|
||||
.maximumWeightedCapacity(capacity).weigher(Weighers.singleton())
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putPDFCache(String key, String value) {
|
||||
if (pdfCache == null) {
|
||||
initPDFCachePool(CacheService.DEFAULT_PDF_CAPACITY);
|
||||
}
|
||||
pdfCache.put(key, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putImgCache(String key, List<String> value) {
|
||||
if (imgCache == null) {
|
||||
initIMGCachePool(CacheService.DEFAULT_IMG_CAPACITY);
|
||||
}
|
||||
imgCache.put(key, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> getPDFCache() {
|
||||
if (pdfCache == null) {
|
||||
initPDFCachePool(CacheService.DEFAULT_PDF_CAPACITY);
|
||||
}
|
||||
return pdfCache;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPDFCache(String key) {
|
||||
if (pdfCache == null) {
|
||||
initPDFCachePool(CacheService.DEFAULT_PDF_CAPACITY);
|
||||
}
|
||||
return pdfCache.get(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, List<String>> getImgCache() {
|
||||
if (imgCache == null) {
|
||||
initPDFCachePool(CacheService.DEFAULT_IMG_CAPACITY);
|
||||
}
|
||||
return imgCache;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getImgCache(String key) {
|
||||
if (imgCache == null) {
|
||||
initPDFCachePool(CacheService.DEFAULT_IMG_CAPACITY);
|
||||
}
|
||||
return imgCache.get(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getPdfImageCache(String key) {
|
||||
if (pdfImagesCache == null) {
|
||||
initPdfImagesCachePool(CacheService.DEFAULT_PDFIMG_CAPACITY);
|
||||
}
|
||||
return pdfImagesCache.get(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putPdfImageCache(String pdfFilePath, int num) {
|
||||
if (pdfImagesCache == null) {
|
||||
initPdfImagesCachePool(CacheService.DEFAULT_PDFIMG_CAPACITY);
|
||||
}
|
||||
pdfImagesCache.put(pdfFilePath, num);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanCache() {
|
||||
initPDFCachePool(CacheService.DEFAULT_PDF_CAPACITY);
|
||||
initIMGCachePool(CacheService.DEFAULT_IMG_CAPACITY);
|
||||
initPdfImagesCachePool(CacheService.DEFAULT_PDFIMG_CAPACITY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addQueueTask(String url) {
|
||||
blockingQueue.add(url);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String takeQueueTask() throws InterruptedException {
|
||||
return String.valueOf(blockingQueue.take());
|
||||
}
|
||||
}
|
||||
130
jodconverter-web/src/main/java/cn/keking/service/cache/impl/CacheServiceRedisImpl.java
vendored
Normal file
130
jodconverter-web/src/main/java/cn/keking/service/cache/impl/CacheServiceRedisImpl.java
vendored
Normal file
@@ -0,0 +1,130 @@
|
||||
package cn.keking.service.cache.impl;
|
||||
|
||||
import cn.keking.service.FileConverQueueTask;
|
||||
import cn.keking.service.cache.CacheService;
|
||||
import org.redisson.Redisson;
|
||||
import org.redisson.api.RBlockingQueue;
|
||||
import org.redisson.api.RMapCache;
|
||||
import org.redisson.api.RedissonClient;
|
||||
import org.redisson.config.Config;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @auther: chenjh
|
||||
* @time: 2019/4/2 18:02
|
||||
* @description
|
||||
*/
|
||||
@ConditionalOnExpression("'${cache.type:default}'.equals('redis')")
|
||||
@Service
|
||||
public class CacheServiceRedisImpl implements CacheService {
|
||||
|
||||
private Config config;
|
||||
|
||||
@Autowired
|
||||
public CacheServiceRedisImpl(Config config) {
|
||||
this.config = config;
|
||||
this.redissonClient = Redisson.create(config);
|
||||
}
|
||||
|
||||
private RedissonClient redissonClient;
|
||||
|
||||
@Override
|
||||
public void initPDFCachePool(Integer capacity) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initIMGCachePool(Integer capacity) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initPdfImagesCachePool(Integer capacity) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putPDFCache(String key, String value) {
|
||||
RMapCache<String, String> convertedList = redissonClient.getMapCache(REDIS_FILE_PREVIEW_PDF_KEY);
|
||||
convertedList.fastPut(key, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putImgCache(String key, List<String> value) {
|
||||
RMapCache<String, List<String>> convertedList = redissonClient.getMapCache(REDIS_FILE_PREVIEW_IMGS_KEY);
|
||||
convertedList.fastPut(key, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> getPDFCache() {
|
||||
return redissonClient.getMapCache(REDIS_FILE_PREVIEW_PDF_KEY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPDFCache(String key) {
|
||||
RMapCache<String, String> convertedList = redissonClient.getMapCache(REDIS_FILE_PREVIEW_PDF_KEY);
|
||||
return convertedList.get(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, List<String>> getImgCache() {
|
||||
return redissonClient.getMapCache(REDIS_FILE_PREVIEW_IMGS_KEY);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getImgCache(String key) {
|
||||
RMapCache<String, List<String>> convertedList = redissonClient.getMapCache(REDIS_FILE_PREVIEW_IMGS_KEY);
|
||||
return convertedList.get(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getPdfImageCache(String key) {
|
||||
RMapCache<String, Integer> convertedList = redissonClient.getMapCache(REDIS_FILE_PREVIEW_PDF_IMGS_KEY);
|
||||
return convertedList.get(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putPdfImageCache(String pdfFilePath, int num) {
|
||||
RMapCache<String, Integer> convertedList = redissonClient.getMapCache(REDIS_FILE_PREVIEW_PDF_IMGS_KEY);
|
||||
convertedList.fastPut(pdfFilePath, num);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanCache() {
|
||||
cleanPdfCache();
|
||||
cleanImgCache();
|
||||
cleanPdfImgCache();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addQueueTask(String url) {
|
||||
RBlockingQueue<String> queue = redissonClient.getBlockingQueue(FileConverQueueTask.queueTaskName);
|
||||
queue.addAsync(url);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String takeQueueTask() throws InterruptedException {
|
||||
RBlockingQueue<String> queue = redissonClient.getBlockingQueue(FileConverQueueTask.queueTaskName);
|
||||
return queue.take();
|
||||
}
|
||||
|
||||
private void cleanPdfCache() {
|
||||
RMapCache<String, String> pdfCache = redissonClient.getMapCache(REDIS_FILE_PREVIEW_PDF_KEY);
|
||||
pdfCache.clear();
|
||||
}
|
||||
|
||||
private void cleanImgCache() {
|
||||
RMapCache<String, List<String>> imgCache = redissonClient.getMapCache(REDIS_FILE_PREVIEW_IMGS_KEY);
|
||||
imgCache.clear();
|
||||
}
|
||||
|
||||
private void cleanPdfImgCache() {
|
||||
RMapCache<String, Integer> pdfImg = redissonClient.getMapCache(REDIS_FILE_PREVIEW_PDF_IMGS_KEY);
|
||||
pdfImg.clear();
|
||||
}
|
||||
}
|
||||
239
jodconverter-web/src/main/java/cn/keking/service/cache/impl/CacheServiceRocksDBImpl.java
vendored
Normal file
239
jodconverter-web/src/main/java/cn/keking/service/cache/impl/CacheServiceRocksDBImpl.java
vendored
Normal file
@@ -0,0 +1,239 @@
|
||||
package cn.keking.service.cache.impl;
|
||||
|
||||
import cn.keking.service.cache.CacheService;
|
||||
import org.artofsolving.jodconverter.office.OfficeUtils;
|
||||
import org.rocksdb.RocksDB;
|
||||
import org.rocksdb.RocksDBException;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ArrayBlockingQueue;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
|
||||
/**
|
||||
* @auther: chenjh
|
||||
* @time: 2019/4/22 11:02
|
||||
* @description
|
||||
*/
|
||||
@ConditionalOnExpression("'${cache.type:default}'.equals('default')")
|
||||
@Service
|
||||
public class CacheServiceRocksDBImpl implements CacheService {
|
||||
|
||||
static {
|
||||
RocksDB.loadLibrary();
|
||||
}
|
||||
|
||||
private static final String DB_PATH = OfficeUtils.getHomePath() + File.separator + "cache";
|
||||
|
||||
private static final int QUEUE_SIZE = 500000;
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(CacheServiceRocksDBImpl.class);
|
||||
|
||||
private BlockingQueue blockingQueue = new ArrayBlockingQueue(QUEUE_SIZE);
|
||||
|
||||
private RocksDB db;
|
||||
|
||||
{
|
||||
try {
|
||||
db = RocksDB.open(DB_PATH);
|
||||
if (db.get(REDIS_FILE_PREVIEW_PDF_KEY.getBytes()) == null) {
|
||||
Map<String, String> initPDFCache = new HashMap<>();
|
||||
db.put(REDIS_FILE_PREVIEW_PDF_KEY.getBytes(), toByteArray(initPDFCache));
|
||||
}
|
||||
if (db.get(REDIS_FILE_PREVIEW_IMGS_KEY.getBytes()) == null) {
|
||||
Map<String, List<String>> initIMGCache = new HashMap<>();
|
||||
db.put(REDIS_FILE_PREVIEW_IMGS_KEY.getBytes(), toByteArray(initIMGCache));
|
||||
}
|
||||
if (db.get(REDIS_FILE_PREVIEW_PDF_IMGS_KEY.getBytes()) == null) {
|
||||
Map<String, Integer> initPDFIMGCache = new HashMap<>();
|
||||
db.put(REDIS_FILE_PREVIEW_PDF_IMGS_KEY.getBytes(), toByteArray(initPDFIMGCache));
|
||||
}
|
||||
} catch (RocksDBException | IOException e) {
|
||||
LOGGER.error("Uable to init RocksDB" + e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void initPDFCachePool(Integer capacity) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initIMGCachePool(Integer capacity) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initPdfImagesCachePool(Integer capacity) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putPDFCache(String key, String value) {
|
||||
try {
|
||||
Map<String, String> pdfCacheItem = getPDFCache();
|
||||
pdfCacheItem.put(key, value);
|
||||
db.put(REDIS_FILE_PREVIEW_PDF_KEY.getBytes(), toByteArray(pdfCacheItem));
|
||||
} catch (RocksDBException | IOException e) {
|
||||
LOGGER.error("Put into RocksDB Exception" + e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putImgCache(String key, List<String> value) {
|
||||
try {
|
||||
Map<String, List<String>> imgCacheItem = getImgCache();
|
||||
imgCacheItem.put(key, value);
|
||||
db.put(REDIS_FILE_PREVIEW_IMGS_KEY.getBytes(), toByteArray(imgCacheItem));
|
||||
} catch (RocksDBException | IOException e) {
|
||||
LOGGER.error("Put into RocksDB Exception" + e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> getPDFCache() {
|
||||
Map<String, String> result = new HashMap<>();
|
||||
try{
|
||||
result = (Map<String, String>) toObject(db.get(REDIS_FILE_PREVIEW_PDF_KEY.getBytes()));
|
||||
} catch (RocksDBException | IOException | ClassNotFoundException e) {
|
||||
LOGGER.error("Get from RocksDB Exception" + e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPDFCache(String key) {
|
||||
String result = "";
|
||||
try{
|
||||
Map<String, String> map = (Map<String, String>) toObject(db.get(REDIS_FILE_PREVIEW_PDF_KEY.getBytes()));
|
||||
result = map.get(key);
|
||||
} catch (RocksDBException | IOException | ClassNotFoundException e) {
|
||||
LOGGER.error("Get from RocksDB Exception" + e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, List<String>> getImgCache() {
|
||||
Map<String, List<String>> result = new HashMap<>();
|
||||
try{
|
||||
result = (Map<String, List<String>>) toObject(db.get(REDIS_FILE_PREVIEW_IMGS_KEY.getBytes()));
|
||||
} catch (RocksDBException | IOException | ClassNotFoundException e) {
|
||||
LOGGER.error("Get from RocksDB Exception" + e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getImgCache(String key) {
|
||||
List<String> result = new ArrayList<>();
|
||||
Map<String, List<String>> map;
|
||||
try{
|
||||
map = (Map<String, List<String>>) toObject(db.get(REDIS_FILE_PREVIEW_IMGS_KEY.getBytes()));
|
||||
result = map.get(key);
|
||||
} catch (RocksDBException | IOException | ClassNotFoundException e) {
|
||||
LOGGER.error("Get from RocksDB Exception" + e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public Map<String, Integer> getPdfImageCaches() {
|
||||
Map<String, Integer> map = new HashMap<>();
|
||||
try{
|
||||
map = (Map<String, Integer>) toObject(db.get(REDIS_FILE_PREVIEW_PDF_IMGS_KEY.getBytes()));
|
||||
} catch (RocksDBException | IOException | ClassNotFoundException e) {
|
||||
LOGGER.error("Get from RocksDB Exception" + e);
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getPdfImageCache(String key) {
|
||||
Integer result = 0;
|
||||
Map<String, Integer> map;
|
||||
try{
|
||||
map = (Map<String, Integer>) toObject(db.get(REDIS_FILE_PREVIEW_PDF_IMGS_KEY.getBytes()));
|
||||
result = map.get(key);
|
||||
} catch (RocksDBException | IOException | ClassNotFoundException e) {
|
||||
LOGGER.error("Get from RocksDB Exception" + e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void putPdfImageCache(String pdfFilePath, int num) {
|
||||
try {
|
||||
Map<String, Integer> pdfImageCacheItem = getPdfImageCaches();
|
||||
pdfImageCacheItem.put(pdfFilePath, num);
|
||||
db.put(REDIS_FILE_PREVIEW_PDF_IMGS_KEY.getBytes(), toByteArray(pdfImageCacheItem));
|
||||
} catch (RocksDBException | IOException e) {
|
||||
LOGGER.error("Put into RocksDB Exception" + e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cleanCache() {
|
||||
try {
|
||||
cleanPdfCache();
|
||||
cleanImgCache();
|
||||
cleanPdfImgCache();
|
||||
} catch (IOException | RocksDBException e) {
|
||||
LOGGER.error("Clean Cache Exception" + e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addQueueTask(String url) {
|
||||
blockingQueue.add(url);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String takeQueueTask() throws InterruptedException {
|
||||
return String.valueOf(blockingQueue.take());
|
||||
}
|
||||
|
||||
private byte[] toByteArray (Object obj) throws IOException {
|
||||
byte[] bytes = null;
|
||||
ByteArrayOutputStream bos = new ByteArrayOutputStream();
|
||||
ObjectOutputStream oos = new ObjectOutputStream(bos);
|
||||
oos.writeObject(obj);
|
||||
oos.flush();
|
||||
bytes = bos.toByteArray ();
|
||||
oos.close();
|
||||
bos.close();
|
||||
return bytes;
|
||||
}
|
||||
|
||||
private Object toObject (byte[] bytes) throws IOException, ClassNotFoundException {
|
||||
Object obj = null;
|
||||
ByteArrayInputStream bis = new ByteArrayInputStream (bytes);
|
||||
ObjectInputStream ois = new ObjectInputStream (bis);
|
||||
obj = ois.readObject();
|
||||
ois.close();
|
||||
bis.close();
|
||||
return obj;
|
||||
}
|
||||
|
||||
private void cleanPdfCache() throws IOException, RocksDBException {
|
||||
Map<String, String> initPDFCache = new HashMap<>();
|
||||
db.put(REDIS_FILE_PREVIEW_PDF_KEY.getBytes(), toByteArray(initPDFCache));
|
||||
}
|
||||
|
||||
private void cleanImgCache() throws IOException, RocksDBException {
|
||||
Map<String, List<String>> initIMGCache = new HashMap<>();
|
||||
db.put(REDIS_FILE_PREVIEW_IMGS_KEY.getBytes(), toByteArray(initIMGCache));
|
||||
}
|
||||
|
||||
private void cleanPdfImgCache() throws IOException, RocksDBException {
|
||||
Map<String, Integer> initPDFIMGCache = new HashMap<>();
|
||||
db.put(REDIS_FILE_PREVIEW_PDF_IMGS_KEY.getBytes(), toByteArray(initPDFIMGCache));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package cn.keking.service.impl;
|
||||
|
||||
import cn.keking.config.ConfigConstants;
|
||||
import cn.keking.model.FileAttribute;
|
||||
import cn.keking.model.ReturnResponse;
|
||||
import cn.keking.service.FilePreview;
|
||||
import cn.keking.utils.DownloadUtils;
|
||||
import cn.keking.utils.FileUtils;
|
||||
import cn.keking.utils.ZipReader;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* Created by kl on 2018/1/17.
|
||||
* Content :处理压缩包文件
|
||||
*/
|
||||
@Service
|
||||
public class CompressFilePreviewImpl implements FilePreview{
|
||||
|
||||
@Autowired
|
||||
FileUtils fileUtils;
|
||||
|
||||
@Autowired
|
||||
DownloadUtils downloadUtils;
|
||||
|
||||
@Autowired
|
||||
ZipReader zipReader;
|
||||
|
||||
@Override
|
||||
public String filePreviewHandle(String url, Model model, FileAttribute fileAttribute) {
|
||||
String fileName=fileAttribute.getName();
|
||||
String suffix=fileAttribute.getSuffix();
|
||||
String fileTree = null;
|
||||
// 判断文件名是否存在(redis缓存读取)
|
||||
if (!StringUtils.hasText(fileUtils.getConvertedFile(fileName)) || !ConfigConstants.isCacheEnabled()) {
|
||||
ReturnResponse<String> response = downloadUtils.downLoad(fileAttribute, fileName);
|
||||
if (0 != response.getCode()) {
|
||||
model.addAttribute("fileType", suffix);
|
||||
model.addAttribute("msg", response.getMsg());
|
||||
return "fileNotSupported";
|
||||
}
|
||||
String filePath = response.getContent();
|
||||
if ("zip".equalsIgnoreCase(suffix) || "jar".equalsIgnoreCase(suffix) || "gzip".equalsIgnoreCase(suffix)) {
|
||||
fileTree = zipReader.readZipFile(filePath, fileName);
|
||||
} else if ("rar".equalsIgnoreCase(suffix)) {
|
||||
fileTree = zipReader.unRar(filePath, fileName);
|
||||
} else if ("7z".equalsIgnoreCase(suffix)) {
|
||||
fileTree = zipReader.read7zFile(filePath, fileName);
|
||||
}
|
||||
if (fileTree != null && !"null".equals(fileTree) && ConfigConstants.isCacheEnabled()) {
|
||||
fileUtils.addConvertedFile(fileName, fileTree);
|
||||
}
|
||||
} else {
|
||||
fileTree = fileUtils.getConvertedFile(fileName);
|
||||
}
|
||||
if (fileTree != null && !"null".equals(fileTree)) {
|
||||
model.addAttribute("fileTree", fileTree);
|
||||
return "compress";
|
||||
} else {
|
||||
model.addAttribute("fileType", suffix);
|
||||
model.addAttribute("msg", "压缩文件类型不受支持,尝试在压缩的时候选择RAR4格式");
|
||||
return "fileNotSupported";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package cn.keking.service.impl;
|
||||
|
||||
import cn.keking.model.FileAttribute;
|
||||
import cn.keking.service.FilePreview;
|
||||
import cn.keking.utils.FileUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.ui.Model;
|
||||
/**
|
||||
* @author : kl
|
||||
* @authorboke : kailing.pub
|
||||
* @create : 2018-03-25 上午11:58
|
||||
* @description:
|
||||
**/
|
||||
@Service
|
||||
public class MediaFilePreviewImpl implements FilePreview {
|
||||
|
||||
@Autowired
|
||||
FileUtils fileUtils;
|
||||
|
||||
@Override
|
||||
public String filePreviewHandle(String url, Model model, FileAttribute fileAttribute) {
|
||||
model.addAttribute("mediaUrl", url);
|
||||
String suffix=fileAttribute.getSuffix();
|
||||
if ("flv".equalsIgnoreCase(suffix)) {
|
||||
return "flv";
|
||||
}
|
||||
return "media";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package cn.keking.service.impl;
|
||||
|
||||
import cn.keking.config.ConfigConstants;
|
||||
import cn.keking.model.FileAttribute;
|
||||
import cn.keking.model.ReturnResponse;
|
||||
import cn.keking.service.FilePreview;
|
||||
import cn.keking.utils.DownloadUtils;
|
||||
import cn.keking.utils.FileUtils;
|
||||
import cn.keking.utils.OfficeToPdf;
|
||||
import cn.keking.utils.PdfUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by kl on 2018/1/17.
|
||||
* Content :处理office文件
|
||||
*/
|
||||
@Service
|
||||
public class OfficeFilePreviewImpl implements FilePreview {
|
||||
|
||||
@Autowired
|
||||
FileUtils fileUtils;
|
||||
|
||||
@Autowired
|
||||
PdfUtils pdfUtils;
|
||||
|
||||
@Autowired
|
||||
DownloadUtils downloadUtils;
|
||||
|
||||
@Autowired
|
||||
private OfficeToPdf officeToPdf;
|
||||
|
||||
String fileDir = ConfigConstants.getFileDir();
|
||||
|
||||
public static final String OFFICE_PREVIEW_TYPE_PDF = "pdf";
|
||||
public static final String OFFICE_PREVIEW_TYPE_IMAGE = "image";
|
||||
public static final String OFFICE_PREVIEW_TYPE_ALLIMAGES = "allImages";
|
||||
|
||||
@Override
|
||||
public String filePreviewHandle(String url, Model model, FileAttribute fileAttribute) {
|
||||
// 预览Type,参数传了就取参数的,没传取系统默认
|
||||
String officePreviewType = model.asMap().get("officePreviewType") == null ? ConfigConstants.getOfficePreviewType() : model.asMap().get("officePreviewType").toString();
|
||||
String originUrl = (String) model.asMap().get("originUrl");
|
||||
String suffix=fileAttribute.getSuffix();
|
||||
String fileName=fileAttribute.getName();
|
||||
boolean isHtml = suffix.equalsIgnoreCase("xls") || suffix.equalsIgnoreCase("xlsx");
|
||||
String pdfName = fileName.substring(0, fileName.lastIndexOf(".") + 1) + (isHtml ? "html" : "pdf");
|
||||
String outFilePath = fileDir + pdfName;
|
||||
// 判断之前是否已转换过,如果转换过,直接返回,否则执行转换
|
||||
if (!fileUtils.listConvertedFiles().containsKey(pdfName) || !ConfigConstants.isCacheEnabled()) {
|
||||
String filePath = fileDir + fileName;
|
||||
ReturnResponse<String> response = downloadUtils.downLoad(fileAttribute, null);
|
||||
if (0 != response.getCode()) {
|
||||
model.addAttribute("fileType", suffix);
|
||||
model.addAttribute("msg", response.getMsg());
|
||||
return "fileNotSupported";
|
||||
}
|
||||
filePath = response.getContent();
|
||||
if (StringUtils.hasText(outFilePath)) {
|
||||
officeToPdf.openOfficeToPDF(filePath, outFilePath);
|
||||
if (isHtml) {
|
||||
// 对转换后的文件进行操作(改变编码方式)
|
||||
fileUtils.doActionConvertedFile(outFilePath);
|
||||
}
|
||||
if (ConfigConstants.isCacheEnabled()) {
|
||||
// 加入缓存
|
||||
fileUtils.addConvertedFile(pdfName, fileUtils.getRelativePath(outFilePath));
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!isHtml && originUrl != null && (OFFICE_PREVIEW_TYPE_IMAGE.equals(officePreviewType) || OFFICE_PREVIEW_TYPE_ALLIMAGES.equals(officePreviewType))) {
|
||||
List<String> imageUrls = pdfUtils.pdf2jpg(outFilePath, pdfName, originUrl);
|
||||
if (imageUrls == null || imageUrls.size() < 1) {
|
||||
model.addAttribute("msg", "office转图片异常,请联系管理员");
|
||||
model.addAttribute("fileType",fileAttribute.getSuffix());
|
||||
return "fileNotSupported";
|
||||
}
|
||||
model.addAttribute("imgurls", imageUrls);
|
||||
model.addAttribute("currentUrl", imageUrls.get(0));
|
||||
if (OFFICE_PREVIEW_TYPE_IMAGE.equals(officePreviewType)) {
|
||||
return "officePicture";
|
||||
} else {
|
||||
return "picture";
|
||||
}
|
||||
}
|
||||
model.addAttribute("pdfUrl", pdfName);
|
||||
return isHtml ? "html" : "pdf";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package cn.keking.service.impl;
|
||||
|
||||
import cn.keking.model.FileAttribute;
|
||||
import cn.keking.service.FilePreview;
|
||||
import cn.keking.utils.FileUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.ui.Model;
|
||||
|
||||
/**
|
||||
* Created by kl on 2018/1/17.
|
||||
* Content :其他文件
|
||||
*/
|
||||
@Service
|
||||
public class OtherFilePreviewImpl implements FilePreview {
|
||||
@Autowired
|
||||
FileUtils fileUtils;
|
||||
|
||||
@Override
|
||||
public String filePreviewHandle(String url, Model model, FileAttribute fileAttribute) {
|
||||
model.addAttribute("fileType",fileAttribute.getSuffix());
|
||||
model.addAttribute("msg", "系统还不支持该格式文件的在线预览," +
|
||||
"如有需要请按下方显示的邮箱地址联系系统维护人员");
|
||||
return "fileNotSupported";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package cn.keking.service.impl;
|
||||
|
||||
import cn.keking.config.ConfigConstants;
|
||||
import cn.keking.model.FileAttribute;
|
||||
import cn.keking.model.ReturnResponse;
|
||||
import cn.keking.service.FilePreview;
|
||||
import cn.keking.utils.DownloadUtils;
|
||||
import cn.keking.utils.FileUtils;
|
||||
import cn.keking.utils.PdfUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.ui.Model;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by kl on 2018/1/17.
|
||||
* Content :处理pdf文件
|
||||
*/
|
||||
@Service
|
||||
public class PdfFilePreviewImpl implements FilePreview{
|
||||
|
||||
|
||||
@Autowired
|
||||
FileUtils fileUtils;
|
||||
|
||||
@Autowired
|
||||
PdfUtils pdfUtils;
|
||||
|
||||
@Autowired
|
||||
DownloadUtils downloadUtils;
|
||||
|
||||
String fileDir = ConfigConstants.getFileDir();
|
||||
|
||||
@Override
|
||||
public String filePreviewHandle(String url, Model model, FileAttribute fileAttribute) {
|
||||
String suffix=fileAttribute.getSuffix();
|
||||
String fileName=fileAttribute.getName();
|
||||
String officePreviewType = model.asMap().get("officePreviewType") == null ? ConfigConstants.getOfficePreviewType() : model.asMap().get("officePreviewType").toString();
|
||||
String originUrl = model.asMap().get("originUrl").toString();
|
||||
model.addAttribute("pdfUrl", url);
|
||||
String pdfName = fileName.substring(0, fileName.lastIndexOf(".") + 1) + "pdf";
|
||||
String outFilePath = fileDir + pdfName;
|
||||
if (OfficeFilePreviewImpl.OFFICE_PREVIEW_TYPE_IMAGE.equals(officePreviewType) || OfficeFilePreviewImpl.OFFICE_PREVIEW_TYPE_ALLIMAGES.equals(officePreviewType)) {
|
||||
//当文件不存在时,就去下载
|
||||
ReturnResponse<String> response = downloadUtils.downLoad(fileAttribute, fileName);
|
||||
if (0 != response.getCode()) {
|
||||
model.addAttribute("fileType", suffix);
|
||||
model.addAttribute("msg", response.getMsg());
|
||||
return "fileNotSupported";
|
||||
}
|
||||
outFilePath = response.getContent();
|
||||
List<String> imageUrls = pdfUtils.pdf2jpg(outFilePath, pdfName, originUrl);
|
||||
if (imageUrls == null || imageUrls.size() < 1) {
|
||||
model.addAttribute("msg", "pdf转图片异常,请联系管理员");
|
||||
model.addAttribute("fileType",fileAttribute.getSuffix());
|
||||
return "fileNotSupported";
|
||||
}
|
||||
model.addAttribute("imgurls", imageUrls);
|
||||
model.addAttribute("currentUrl", imageUrls.get(0));
|
||||
if (OfficeFilePreviewImpl.OFFICE_PREVIEW_TYPE_IMAGE.equals(officePreviewType)) {
|
||||
return "officePicture";
|
||||
} else {
|
||||
return "picture";
|
||||
}
|
||||
}
|
||||
return "pdf";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package cn.keking.service.impl;
|
||||
|
||||
import cn.keking.model.FileAttribute;
|
||||
import cn.keking.service.FilePreview;
|
||||
import cn.keking.utils.FileUtils;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by kl on 2018/1/17.
|
||||
* Content :图片文件处理
|
||||
*/
|
||||
@Service
|
||||
public class PictureFilePreviewImpl implements FilePreview {
|
||||
|
||||
@Autowired
|
||||
FileUtils fileUtils;
|
||||
|
||||
@Override
|
||||
public String filePreviewHandle(String url, Model model, FileAttribute fileAttribute) {
|
||||
String fileKey=(String) RequestContextHolder.currentRequestAttributes().getAttribute("fileKey",0);
|
||||
List imgUrls = Lists.newArrayList(url);
|
||||
try{
|
||||
imgUrls.clear();
|
||||
imgUrls.addAll(fileUtils.getRedisImgUrls(fileKey));
|
||||
}catch (Exception e){
|
||||
imgUrls = Lists.newArrayList(url);
|
||||
}
|
||||
model.addAttribute("imgurls", imgUrls);
|
||||
model.addAttribute("currentUrl",url);
|
||||
return "picture";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package cn.keking.service.impl;
|
||||
|
||||
import cn.keking.model.FileAttribute;
|
||||
import cn.keking.model.ReturnResponse;
|
||||
import cn.keking.service.FilePreview;
|
||||
import cn.keking.utils.FileUtils;
|
||||
import cn.keking.utils.SimTextUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.ui.Model;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
|
||||
/**
|
||||
* Created by kl on 2018/1/17.
|
||||
* Content :处理文本文件
|
||||
*/
|
||||
@Service
|
||||
public class SimTextFilePreviewImpl implements FilePreview{
|
||||
|
||||
@Autowired
|
||||
SimTextUtil simTextUtil;
|
||||
|
||||
@Autowired
|
||||
FileUtils fileUtils;
|
||||
|
||||
@Override
|
||||
public String filePreviewHandle(String url, Model model, FileAttribute fileAttribute){
|
||||
String decodedUrl=fileAttribute.getDecodedUrl();
|
||||
String fileName=fileAttribute.getName();
|
||||
ReturnResponse<String> response = simTextUtil.readSimText(decodedUrl, fileName);
|
||||
if (0 != response.getCode()) {
|
||||
model.addAttribute("msg", response.getMsg());
|
||||
model.addAttribute("fileType",fileAttribute.getSuffix());
|
||||
return "fileNotSupported";
|
||||
}
|
||||
try {
|
||||
File originFile = new File(response.getContent());
|
||||
File previewFile = new File(response.getContent() + ".txt");
|
||||
Files.copy(originFile.toPath(), previewFile.toPath());
|
||||
} catch (IOException e) {
|
||||
model.addAttribute("msg", e.getLocalizedMessage());
|
||||
model.addAttribute("fileType",fileAttribute.getSuffix());
|
||||
return "fileNotSupported";
|
||||
}
|
||||
model.addAttribute("ordinaryUrl", response.getMsg() + ".txt");
|
||||
return "txt";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,10 +1,11 @@
|
||||
package com.yudianbank.utils;
|
||||
package cn.keking.utils;
|
||||
|
||||
import com.sun.star.document.UpdateDocMode;
|
||||
import com.yudianbank.extend.ControlDocumentFormatRegistry;
|
||||
import cn.keking.extend.ControlDocumentFormatRegistry;
|
||||
import org.artofsolving.jodconverter.OfficeDocumentConverter;
|
||||
import org.artofsolving.jodconverter.office.DefaultOfficeManagerConfiguration;
|
||||
import org.artofsolving.jodconverter.office.OfficeManager;
|
||||
import org.artofsolving.jodconverter.office.OfficeUtils;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -23,8 +24,8 @@ import java.util.Map;
|
||||
@Component
|
||||
public class ConverterUtils {
|
||||
|
||||
@Value("${office.home}")
|
||||
String officeHome;
|
||||
// @Value("${office.home}")
|
||||
// String officeHome;
|
||||
// OpenOfficeConnection connection;
|
||||
OfficeManager officeManager;
|
||||
|
||||
@@ -32,6 +33,7 @@ public class ConverterUtils {
|
||||
public void initOfficeManager() {
|
||||
//// connection = new SocketOpenOfficeConnection(host,8100);
|
||||
//// connection.connect();
|
||||
String officeHome = OfficeUtils.getDefaultOfficeHome().getAbsolutePath();
|
||||
DefaultOfficeManagerConfiguration configuration = new DefaultOfficeManagerConfiguration();
|
||||
configuration.setOfficeHome(officeHome);
|
||||
configuration.setPortNumber(8100);
|
||||
@@ -1,8 +1,14 @@
|
||||
package com.yudianbank.utils;
|
||||
package cn.keking.utils;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class DeleteFileUtil {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(DeleteFileUtil.class);
|
||||
|
||||
/**
|
||||
* 删除单个文件
|
||||
*
|
||||
@@ -15,14 +21,14 @@ public class DeleteFileUtil {
|
||||
// 如果文件路径所对应的文件存在,并且是一个文件,则直接删除
|
||||
if (file.exists() && file.isFile()) {
|
||||
if (file.delete()) {
|
||||
System.out.println("删除单个文件" + fileName + "成功!");
|
||||
LOGGER.info("删除单个文件" + fileName + "成功!");
|
||||
return true;
|
||||
} else {
|
||||
System.out.println("删除单个文件" + fileName + "失败!");
|
||||
LOGGER.info("删除单个文件" + fileName + "失败!");
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
System.out.println("删除单个文件失败:" + fileName + "不存在!");
|
||||
LOGGER.info("删除单个文件失败:" + fileName + "不存在!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -43,7 +49,7 @@ public class DeleteFileUtil {
|
||||
File dirFile = new File(dir);
|
||||
// 如果dir对应的文件不存在,或者不是一个目录,则退出
|
||||
if ((!dirFile.exists()) || (!dirFile.isDirectory())) {
|
||||
System.out.println("删除目录失败:" + dir + "不存在!");
|
||||
LOGGER.info("删除目录失败:" + dir + "不存在!");
|
||||
return false;
|
||||
}
|
||||
boolean flag = true;
|
||||
@@ -65,7 +71,7 @@ public class DeleteFileUtil {
|
||||
}
|
||||
}
|
||||
if (!flag) {
|
||||
System.out.println("删除目录失败!");
|
||||
LOGGER.info("删除目录失败!");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -1,11 +1,14 @@
|
||||
package com.yudianbank.utils;
|
||||
package cn.keking.utils;
|
||||
|
||||
import com.yudianbank.param.ReturnResponse;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import cn.keking.config.ConfigConstants;
|
||||
import cn.keking.model.FileAttribute;
|
||||
import cn.keking.model.ReturnResponse;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
@@ -14,8 +17,16 @@ import java.util.UUID;
|
||||
@Component
|
||||
public class DownloadUtils {
|
||||
|
||||
@Value("${file.dir}")
|
||||
String fileDir;
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(DownloadUtils.class);
|
||||
|
||||
private String fileDir = ConfigConstants.getFileDir();
|
||||
|
||||
@Autowired
|
||||
private FileUtils fileUtils;
|
||||
|
||||
private static final String URL_PARAM_FTP_USERNAME = "ftp.username";
|
||||
private static final String URL_PARAM_FTP_PASSWORD = "ftp.password";
|
||||
private static final String URL_PARAM_FTP_CONTROL_ENCODING = "ftp.control.encoding";
|
||||
|
||||
/**
|
||||
* 一开始测试的时候发现有些文件没有下载下来,而有些可以;当时也是郁闷了好一阵,但是最终还是不得解
|
||||
@@ -23,18 +34,21 @@ public class DownloadUtils {
|
||||
* 应该是转义出了问题,url转义中会把+号当成空格来计算,所以才会出现这种情况,遂想要通过整体替换空格为加号,因为url
|
||||
* 中的参数部分是不会出现空格的,但是文件名中就不好确定了,所以只对url参数部分做替换
|
||||
* 注: 针对URLEncoder.encode(s,charset)会将空格转成+的情况需要做下面的替换工作
|
||||
* @param urlAddress
|
||||
* @param type
|
||||
* @param fileAttribute
|
||||
* @return
|
||||
*/
|
||||
public ReturnResponse<String> downLoad(String urlAddress, String type, String fileName){
|
||||
public ReturnResponse<String> downLoad(FileAttribute fileAttribute, String fileName) {
|
||||
String urlAddress = fileAttribute.getDecodedUrl();
|
||||
String type = fileAttribute.getSuffix();
|
||||
ReturnResponse<String> response = new ReturnResponse<>(0, "下载成功!!!", "");
|
||||
URL url = null;
|
||||
try {
|
||||
urlAddress = replacePlusMark(urlAddress);
|
||||
urlAddress = encodeUrlParam(urlAddress);
|
||||
// 因为tomcat不能处理'+'号,所以讲'+'号替换成'%20%'
|
||||
// 也不能处理空格
|
||||
urlAddress = urlAddress.replaceAll("\\+", "%20");
|
||||
urlAddress = urlAddress.replaceAll(" ", "%20");
|
||||
url = new URL(urlAddress);
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
@@ -42,7 +56,7 @@ public class DownloadUtils {
|
||||
UUID uuid = UUID.randomUUID();
|
||||
if (null == fileName) {
|
||||
fileName = uuid+ "."+type;
|
||||
}else { // 文件后缀不一致时,以type为准(针对simText【将类txt文件转为txt】)
|
||||
} else { // 文件后缀不一致时,以type为准(针对simText【将类txt文件转为txt】)
|
||||
fileName = fileName.replace(fileName.substring(fileName.lastIndexOf(".") + 1), type);
|
||||
}
|
||||
String realPath = fileDir + fileName;
|
||||
@@ -51,17 +65,24 @@ public class DownloadUtils {
|
||||
dirFile.mkdirs();
|
||||
}
|
||||
try {
|
||||
URLConnection connection = url.openConnection();
|
||||
InputStream in = connection.getInputStream();
|
||||
if ("ftp".equals(url.getProtocol())) {
|
||||
String ftpUsername = fileUtils.getUrlParameterReg(fileAttribute.getUrl(), URL_PARAM_FTP_USERNAME);
|
||||
String ftpPassword = fileUtils.getUrlParameterReg(fileAttribute.getUrl(), URL_PARAM_FTP_PASSWORD);
|
||||
String ftpControlEncoding = fileUtils.getUrlParameterReg(fileAttribute.getUrl(), URL_PARAM_FTP_CONTROL_ENCODING);
|
||||
FtpUtils.download(fileAttribute.getUrl(), realPath, ftpUsername, ftpPassword, ftpControlEncoding);
|
||||
} else {
|
||||
URLConnection connection = url.openConnection();
|
||||
InputStream in = connection.getInputStream();
|
||||
|
||||
FileOutputStream os = new FileOutputStream(realPath);
|
||||
byte[] buffer = new byte[4 * 1024];
|
||||
int read;
|
||||
while ((read = in.read(buffer)) > 0) {
|
||||
os.write(buffer, 0, read);
|
||||
FileOutputStream os = new FileOutputStream(realPath);
|
||||
byte[] buffer = new byte[4 * 1024];
|
||||
int read;
|
||||
while ((read = in.read(buffer)) > 0) {
|
||||
os.write(buffer, 0, read);
|
||||
}
|
||||
os.close();
|
||||
in.close();
|
||||
}
|
||||
os.close();
|
||||
in.close();
|
||||
response.setContent(realPath);
|
||||
// 同样针对类txt文件,如果成功msg包含的是转换后的文件名
|
||||
response.setMsg(fileName);
|
||||
@@ -70,15 +91,14 @@ public class DownloadUtils {
|
||||
if("txt".equals(type)){
|
||||
convertTextPlainFileCharsetToUtf8(realPath);
|
||||
}
|
||||
|
||||
return response;
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
LOGGER.error("文件下载失败", e);
|
||||
response.setCode(1);
|
||||
response.setContent(null);
|
||||
if (e instanceof FileNotFoundException) {
|
||||
response.setMsg("文件不存在!!!");
|
||||
}else {
|
||||
} else {
|
||||
response.setMsg(e.getMessage());
|
||||
}
|
||||
return response;
|
||||
@@ -105,30 +125,35 @@ public class DownloadUtils {
|
||||
* 对最有一个路径进行转码
|
||||
* @param urlAddress
|
||||
* http://192.168.2.111:8013/demo/Handle中文.zip
|
||||
* http://192.168.2.111:8013/download?id=1&filename=中文.zip
|
||||
* @return
|
||||
*/
|
||||
private String encodeUrlParam(String urlAddress) {
|
||||
String newUrl = "";
|
||||
try {
|
||||
String path = "";
|
||||
String param = "";
|
||||
if (urlAddress.contains("?")) {
|
||||
path = urlAddress.substring(0, urlAddress.indexOf("?"));
|
||||
param = urlAddress.substring(urlAddress.indexOf("?"));
|
||||
}else {
|
||||
path = urlAddress;
|
||||
|
||||
private String encodeUrlParam(String urlAddress){
|
||||
StringBuffer sb = new StringBuffer();
|
||||
for (int i = 0; i < urlAddress.length(); i++) {
|
||||
char c = urlAddress.charAt(i);
|
||||
if (c >= 0 && c <= 255) {
|
||||
sb.append(c);
|
||||
} else {
|
||||
byte[] b;
|
||||
try {
|
||||
//指定需要的编码类型
|
||||
b = String.valueOf(c).getBytes("utf-8");
|
||||
} catch (Exception ex) {
|
||||
System.out.println(ex);
|
||||
b = new byte[0];
|
||||
}
|
||||
for (int j = 0; j < b.length; j++) {
|
||||
int k = b[j];
|
||||
if (k < 0) {
|
||||
k += 256;
|
||||
}
|
||||
sb.append("%" + Integer.toHexString(k).toUpperCase());
|
||||
}
|
||||
}
|
||||
String lastPath = path.substring(path.lastIndexOf("/") + 1);
|
||||
String leftPath = path.substring(0, path.lastIndexOf("/") + 1);
|
||||
String encodeLastPath = URLEncoder.encode(lastPath, "UTF-8");
|
||||
newUrl += leftPath + encodeLastPath;
|
||||
if (urlAddress.contains("?")) {
|
||||
newUrl += param;
|
||||
}
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return newUrl;
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,157 +1,157 @@
|
||||
package com.yudianbank.utils;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.mozilla.intl.chardet.nsDetector;
|
||||
import org.mozilla.intl.chardet.nsICharsetDetectionObserver;
|
||||
|
||||
/**
|
||||
* 文本文件编码探测工具类
|
||||
*
|
||||
* @author HWliao
|
||||
* @date 2017-12-24
|
||||
*/
|
||||
public class FileCharsetDetector {
|
||||
|
||||
/**
|
||||
* 传入一个文件(File)对象,检查文件编码
|
||||
*
|
||||
* @param file File对象实例
|
||||
* @return 文件编码,若无,则返回null
|
||||
* @throws FileNotFoundException
|
||||
* @throws IOException
|
||||
*/
|
||||
public static Observer guessFileEncoding(File file)
|
||||
throws FileNotFoundException, IOException {
|
||||
return guessFileEncoding(file, new nsDetector());
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 获取文件的编码
|
||||
* @param file
|
||||
* File对象实例
|
||||
* @param languageHint
|
||||
* 语言提示区域代码 @see #nsPSMDetector ,取值如下:
|
||||
* 1 : Japanese
|
||||
* 2 : Chinese
|
||||
* 3 : Simplified Chinese
|
||||
* 4 : Traditional Chinese
|
||||
* 5 : Korean
|
||||
* 6 : Dont know(default)
|
||||
* </pre>
|
||||
*
|
||||
* @return 文件编码,eg:UTF-8,GBK,GB2312形式(不确定的时候,返回可能的字符编码序列);若无,则返回null
|
||||
* @throws FileNotFoundException
|
||||
* @throws IOException
|
||||
*/
|
||||
public static Observer guessFileEncoding(File file, int languageHint)
|
||||
throws FileNotFoundException, IOException {
|
||||
return guessFileEncoding(file, new nsDetector(languageHint));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件的编码
|
||||
*
|
||||
* @param file
|
||||
* @param det
|
||||
* @return
|
||||
* @throws FileNotFoundException
|
||||
* @throws IOException
|
||||
*/
|
||||
private static Observer guessFileEncoding(File file, nsDetector det)
|
||||
throws FileNotFoundException, IOException {
|
||||
// new Observer
|
||||
Observer observer = new Observer();
|
||||
// set Observer
|
||||
// The Notify() will be called when a matching charset is found.
|
||||
det.Init(observer);
|
||||
|
||||
BufferedInputStream imp = new BufferedInputStream(new FileInputStream(
|
||||
file));
|
||||
byte[] buf = new byte[1024];
|
||||
int len;
|
||||
boolean done = false;
|
||||
boolean isAscii = false;
|
||||
|
||||
while ((len = imp.read(buf, 0, buf.length)) != -1) {
|
||||
// Check if the stream is only ascii.
|
||||
isAscii = det.isAscii(buf, len);
|
||||
if (isAscii) {
|
||||
break;
|
||||
}
|
||||
// DoIt if non-ascii and not done yet.
|
||||
done = det.DoIt(buf, len, false);
|
||||
if (done) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
imp.close();
|
||||
det.DataEnd();
|
||||
|
||||
if (isAscii) {
|
||||
observer.encoding = "ASCII";
|
||||
observer.found = true;
|
||||
}
|
||||
|
||||
if (!observer.isFound()) {
|
||||
String[] prob = det.getProbableCharsets();
|
||||
// // 这里将可能的字符集组合起来返回
|
||||
// for (int i = 0; i < prob.length; i++) {
|
||||
// if (i == 0) {
|
||||
// encoding = prob[i];
|
||||
// } else {
|
||||
// encoding += "," + prob[i];
|
||||
// }
|
||||
// }
|
||||
if (prob.length > 0) {
|
||||
// 在没有发现情况下,去第一个可能的编码
|
||||
observer.encoding = prob[0];
|
||||
} else {
|
||||
observer.encoding = null;
|
||||
}
|
||||
}
|
||||
return observer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @author liaohongwei
|
||||
* @Description: 文件字符编码观察者, 但判断出字符编码时候调用
|
||||
* @date 2016年6月20日 下午2:27:06
|
||||
*/
|
||||
public static class Observer implements nsICharsetDetectionObserver {
|
||||
|
||||
/**
|
||||
* @Fields encoding : 字符编码
|
||||
*/
|
||||
private String encoding = null;
|
||||
/**
|
||||
* @Fields found : 是否找到字符集
|
||||
*/
|
||||
private boolean found = false;
|
||||
|
||||
@Override
|
||||
public void Notify(String charset) {
|
||||
this.encoding = charset;
|
||||
this.found = true;
|
||||
}
|
||||
|
||||
public String getEncoding() {
|
||||
return encoding;
|
||||
}
|
||||
|
||||
public boolean isFound() {
|
||||
return found;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Observer [encoding=" + encoding + ", found=" + found + "]";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
package cn.keking.utils;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
|
||||
import org.mozilla.intl.chardet.nsDetector;
|
||||
import org.mozilla.intl.chardet.nsICharsetDetectionObserver;
|
||||
|
||||
/**
|
||||
* 文本文件编码探测工具类
|
||||
*
|
||||
* @author HWliao
|
||||
* @date 2017-12-24
|
||||
*/
|
||||
public class FileCharsetDetector {
|
||||
|
||||
/**
|
||||
* 传入一个文件(File)对象,检查文件编码
|
||||
*
|
||||
* @param file File对象实例
|
||||
* @return 文件编码,若无,则返回null
|
||||
* @throws FileNotFoundException
|
||||
* @throws IOException
|
||||
*/
|
||||
public static Observer guessFileEncoding(File file)
|
||||
throws FileNotFoundException, IOException {
|
||||
return guessFileEncoding(file, new nsDetector());
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 获取文件的编码
|
||||
* @param file
|
||||
* File对象实例
|
||||
* @param languageHint
|
||||
* 语言提示区域代码 @see #nsPSMDetector ,取值如下:
|
||||
* 1 : Japanese
|
||||
* 2 : Chinese
|
||||
* 3 : Simplified Chinese
|
||||
* 4 : Traditional Chinese
|
||||
* 5 : Korean
|
||||
* 6 : Dont know(default)
|
||||
* </pre>
|
||||
*
|
||||
* @return 文件编码,eg:UTF-8,GBK,GB2312形式(不确定的时候,返回可能的字符编码序列);若无,则返回null
|
||||
* @throws FileNotFoundException
|
||||
* @throws IOException
|
||||
*/
|
||||
public static Observer guessFileEncoding(File file, int languageHint)
|
||||
throws FileNotFoundException, IOException {
|
||||
return guessFileEncoding(file, new nsDetector(languageHint));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件的编码
|
||||
*
|
||||
* @param file
|
||||
* @param det
|
||||
* @return
|
||||
* @throws FileNotFoundException
|
||||
* @throws IOException
|
||||
*/
|
||||
private static Observer guessFileEncoding(File file, nsDetector det)
|
||||
throws FileNotFoundException, IOException {
|
||||
// new Observer
|
||||
Observer observer = new Observer();
|
||||
// set Observer
|
||||
// The Notify() will be called when a matching charset is found.
|
||||
det.Init(observer);
|
||||
|
||||
BufferedInputStream imp = new BufferedInputStream(new FileInputStream(
|
||||
file));
|
||||
byte[] buf = new byte[1024];
|
||||
int len;
|
||||
boolean done = false;
|
||||
boolean isAscii = false;
|
||||
|
||||
while ((len = imp.read(buf, 0, buf.length)) != -1) {
|
||||
// Check if the stream is only ascii.
|
||||
isAscii = det.isAscii(buf, len);
|
||||
if (isAscii) {
|
||||
break;
|
||||
}
|
||||
// DoIt if non-ascii and not done yet.
|
||||
done = det.DoIt(buf, len, false);
|
||||
if (done) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
imp.close();
|
||||
det.DataEnd();
|
||||
|
||||
if (isAscii) {
|
||||
observer.encoding = "ASCII";
|
||||
observer.found = true;
|
||||
}
|
||||
|
||||
if (!observer.isFound()) {
|
||||
String[] prob = det.getProbableCharsets();
|
||||
// // 这里将可能的字符集组合起来返回
|
||||
// for (int i = 0; i < prob.length; i++) {
|
||||
// if (i == 0) {
|
||||
// encoding = prob[i];
|
||||
// } else {
|
||||
// encoding += "," + prob[i];
|
||||
// }
|
||||
// }
|
||||
if (prob.length > 0) {
|
||||
// 在没有发现情况下,去第一个可能的编码
|
||||
observer.encoding = prob[0];
|
||||
} else {
|
||||
observer.encoding = null;
|
||||
}
|
||||
}
|
||||
return observer;
|
||||
}
|
||||
|
||||
/**
|
||||
* @author liaohongwei
|
||||
* @Description: 文件字符编码观察者, 但判断出字符编码时候调用
|
||||
* @date 2016年6月20日 下午2:27:06
|
||||
*/
|
||||
public static class Observer implements nsICharsetDetectionObserver {
|
||||
|
||||
/**
|
||||
* @Fields encoding : 字符编码
|
||||
*/
|
||||
private String encoding = null;
|
||||
/**
|
||||
* @Fields found : 是否找到字符集
|
||||
*/
|
||||
private boolean found = false;
|
||||
|
||||
@Override
|
||||
public void Notify(String charset) {
|
||||
this.encoding = charset;
|
||||
this.found = true;
|
||||
}
|
||||
|
||||
public String getEncoding() {
|
||||
return encoding;
|
||||
}
|
||||
|
||||
public boolean isFound() {
|
||||
return found;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "Observer [encoding=" + encoding + ", found=" + found + "]";
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
347
jodconverter-web/src/main/java/cn/keking/utils/FileUtils.java
Normal file
347
jodconverter-web/src/main/java/cn/keking/utils/FileUtils.java
Normal file
@@ -0,0 +1,347 @@
|
||||
package cn.keking.utils;
|
||||
|
||||
import cn.keking.config.ConfigConstants;
|
||||
import cn.keking.model.FileAttribute;
|
||||
import cn.keking.model.FileType;
|
||||
import cn.keking.service.cache.CacheService;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author yudian-it
|
||||
* @date 2017/11/13
|
||||
*/
|
||||
@Component
|
||||
public class FileUtils {
|
||||
|
||||
public static final String DEFAULT_CONVERTER_CHARSET = System.getProperty("sun.jnu.encoding");
|
||||
|
||||
Logger log= LoggerFactory.getLogger(getClass());
|
||||
|
||||
@Autowired
|
||||
CacheService cacheService;
|
||||
|
||||
String fileDir = ConfigConstants.getFileDir();
|
||||
|
||||
/**
|
||||
* 已转换过的文件集合(redis缓存)
|
||||
* @return
|
||||
*/
|
||||
public Map<String, String> listConvertedFiles() {
|
||||
return cacheService.getPDFCache();
|
||||
}
|
||||
|
||||
/**
|
||||
* 已转换过的文件,根据文件名获取
|
||||
* @return
|
||||
*/
|
||||
public String getConvertedFile(String key) {
|
||||
return cacheService.getPDFCache(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* 已将pdf转换成图片的图片本地路径
|
||||
* @param key pdf本地路径
|
||||
* @return
|
||||
*/
|
||||
public Integer getConvertedPdfImage(String key) {
|
||||
return cacheService.getPdfImageCache(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看文件类型(防止参数中存在.点号或者其他特殊字符,所以先抽取文件名,然后再获取文件类型)
|
||||
*
|
||||
* @param url
|
||||
* @return
|
||||
*/
|
||||
public FileType typeFromUrl(String url) {
|
||||
String nonPramStr = url.substring(0, url.indexOf("?") != -1 ? url.indexOf("?") : url.length());
|
||||
String fileName = nonPramStr.substring(nonPramStr.lastIndexOf("/") + 1);
|
||||
return typeFromFileName(fileName);
|
||||
}
|
||||
|
||||
private FileType typeFromFileName(String fileName) {
|
||||
String[] simText = ConfigConstants.getSimText();
|
||||
String[] media = ConfigConstants.getMedia();
|
||||
String fileType = fileName.substring(fileName.lastIndexOf(".") + 1);
|
||||
if (listPictureTypes().contains(fileType.toLowerCase())) {
|
||||
return FileType.picture;
|
||||
}
|
||||
if (listArchiveTypes().contains(fileType.toLowerCase())) {
|
||||
return FileType.compress;
|
||||
}
|
||||
if (listOfficeTypes().contains(fileType.toLowerCase())) {
|
||||
return FileType.office;
|
||||
}
|
||||
if (Arrays.asList(simText).contains(fileType.toLowerCase())) {
|
||||
return FileType.simText;
|
||||
}
|
||||
if (Arrays.asList(media).contains(fileType.toLowerCase())) {
|
||||
return FileType.media;
|
||||
}
|
||||
if("pdf".equalsIgnoreCase(fileType)){
|
||||
return FileType.pdf;
|
||||
}
|
||||
return FileType.other;
|
||||
}
|
||||
/**
|
||||
* 从url中剥离出文件名
|
||||
* @param url
|
||||
* 格式如:http://keking.ufile.ucloud.com.cn/20171113164107_月度绩效表模板(新).xls?UCloudPublicKey=ucloudtangshd@weifenf.com14355492830001993909323&Expires=&Signature=I D1NOFtAJSPT16E6imv6JWuq0k=
|
||||
* @return
|
||||
*/
|
||||
public String getFileNameFromURL(String url) {
|
||||
// 因为url的参数中可能会存在/的情况,所以直接url.lastIndexOf("/")会有问题
|
||||
// 所以先从?处将url截断,然后运用url.lastIndexOf("/")获取文件名
|
||||
String noQueryUrl = url.substring(0, url.indexOf("?") != -1 ? url.indexOf("?"): url.length());
|
||||
String fileName = noQueryUrl.substring(noQueryUrl.lastIndexOf("/") + 1);
|
||||
return fileName;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件后缀
|
||||
* @param fileName
|
||||
* @return
|
||||
*/
|
||||
public String getSuffixFromFileName(String fileName) {
|
||||
String suffix = fileName.substring(fileName.lastIndexOf("."));
|
||||
return suffix;
|
||||
}
|
||||
|
||||
/**
|
||||
* 从路径中获取
|
||||
* @param path
|
||||
* 类似这种:C:\Users\yudian-it\Downloads
|
||||
* @return
|
||||
*/
|
||||
public String getFileNameFromPath(String path) {
|
||||
return path.substring(path.lastIndexOf(File.separator) + 1);
|
||||
}
|
||||
|
||||
public List<String> listPictureTypes(){
|
||||
List<String> list = Lists.newArrayList();
|
||||
list.add("jpg");
|
||||
list.add("jpeg");
|
||||
list.add("png");
|
||||
list.add("gif");
|
||||
list.add("bmp");
|
||||
list.add("ico");
|
||||
list.add("RAW");
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<String> listArchiveTypes(){
|
||||
List<String> list = Lists.newArrayList();
|
||||
list.add("rar");
|
||||
list.add("zip");
|
||||
list.add("jar");
|
||||
list.add("7-zip");
|
||||
list.add("tar");
|
||||
list.add("gzip");
|
||||
list.add("7z");
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<String> listOfficeTypes() {
|
||||
List<String> list = Lists.newArrayList();
|
||||
list.add("docx");
|
||||
list.add("doc");
|
||||
list.add("xls");
|
||||
list.add("xlsx");
|
||||
list.add("ppt");
|
||||
list.add("pptx");
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取相对路径
|
||||
* @param absolutePath
|
||||
* @return
|
||||
*/
|
||||
public String getRelativePath(String absolutePath) {
|
||||
return absolutePath.substring(fileDir.length());
|
||||
}
|
||||
|
||||
public void addConvertedFile(String fileName, String value){
|
||||
cacheService.putPDFCache(fileName, value);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param pdfFilePath
|
||||
* @param num
|
||||
*/
|
||||
public void addConvertedPdfImage(String pdfFilePath, int num){
|
||||
cacheService.putPdfImageCache(pdfFilePath, num);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取redis中压缩包内图片文件
|
||||
* @param fileKey
|
||||
* @return
|
||||
*/
|
||||
public List getRedisImgUrls(String fileKey){
|
||||
return cacheService.getImgCache(fileKey);
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置redis中压缩包内图片文件
|
||||
* @param fileKey
|
||||
* @param imgs
|
||||
*/
|
||||
public void setRedisImgUrls(String fileKey,List imgs){
|
||||
cacheService.putImgCache(fileKey, imgs);
|
||||
}
|
||||
/**
|
||||
* 判断文件编码格式
|
||||
* @param path
|
||||
* @return
|
||||
*/
|
||||
public String getFileEncodeUTFGBK(String path){
|
||||
String enc = Charset.forName("GBK").name();
|
||||
File file = new File(path);
|
||||
InputStream in= null;
|
||||
try {
|
||||
in = new FileInputStream(file);
|
||||
byte[] b = new byte[3];
|
||||
in.read(b);
|
||||
in.close();
|
||||
if (b[0] == -17 && b[1] == -69 && b[2] == -65) {
|
||||
enc = Charset.forName("UTF-8").name();
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
System.out.println("文件编码格式为:" + enc);
|
||||
return enc;
|
||||
}
|
||||
|
||||
/**
|
||||
* 对转换后的文件进行操作(改变编码方式)
|
||||
* @param outFilePath
|
||||
*/
|
||||
public void doActionConvertedFile(String outFilePath) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
try (InputStream inputStream = new FileInputStream(outFilePath);
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, DEFAULT_CONVERTER_CHARSET))){
|
||||
String line;
|
||||
while(null != (line = reader.readLine())){
|
||||
if (line.contains("charset=gb2312")) {
|
||||
line = line.replace("charset=gb2312", "charset=utf-8");
|
||||
}
|
||||
sb.append(line);
|
||||
}
|
||||
// 添加sheet控制头
|
||||
sb.append("<script src=\"js/jquery-3.0.0.min.js\" type=\"text/javascript\"></script>");
|
||||
sb.append("<script src=\"js/excel.header.js\" type=\"text/javascript\"></script>");
|
||||
sb.append("<link rel=\"stylesheet\" href=\"//cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css\">");
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// 重新写入文件
|
||||
try(FileOutputStream fos = new FileOutputStream(outFilePath);
|
||||
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(fos, "utf-8"))) {
|
||||
writer.write(sb.toString());
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 获取文件后缀
|
||||
* @param url
|
||||
* @return
|
||||
*/
|
||||
private String suffixFromUrl(String url) {
|
||||
String nonPramStr = url.substring(0, url.indexOf("?") != -1 ? url.indexOf("?") : url.length());
|
||||
String fileName = nonPramStr.substring(nonPramStr.lastIndexOf("/") + 1);
|
||||
return suffixFromFileName(fileName);
|
||||
}
|
||||
|
||||
private String suffixFromFileName(String fileName) {
|
||||
String fileType = fileName.substring(fileName.lastIndexOf(".") + 1);
|
||||
return fileType;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取url中的参数
|
||||
* @param url
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
public String getUrlParameterReg(String url, String name) {
|
||||
Map<String, String> mapRequest = new HashMap();
|
||||
String strUrlParam = truncateUrlPage(url);
|
||||
if (strUrlParam == null) {
|
||||
return "";
|
||||
}
|
||||
//每个键值为一组
|
||||
String[] arrSplit=strUrlParam.split("[&]");
|
||||
for(String strSplit:arrSplit) {
|
||||
String[] arrSplitEqual= strSplit.split("[=]");
|
||||
//解析出键值
|
||||
if(arrSplitEqual.length > 1) {
|
||||
//正确解析
|
||||
mapRequest.put(arrSplitEqual[0], arrSplitEqual[1]);
|
||||
} else if (!arrSplitEqual[0].equals("")) {
|
||||
//只有参数没有值,不加入
|
||||
mapRequest.put(arrSplitEqual[0], "");
|
||||
}
|
||||
}
|
||||
return mapRequest.get(name);
|
||||
}
|
||||
|
||||
/**
|
||||
* 去掉url中的路径,留下请求参数部分
|
||||
* @param strURL url地址
|
||||
* @return url请求参数部分
|
||||
*/
|
||||
private String truncateUrlPage(String strURL) {
|
||||
String strAllParam = null;
|
||||
strURL = strURL.trim();
|
||||
String[] arrSplit = strURL.split("[?]");
|
||||
if(strURL.length() > 1) {
|
||||
if(arrSplit.length > 1) {
|
||||
if(arrSplit[1] != null) {
|
||||
strAllParam=arrSplit[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
return strAllParam;
|
||||
}
|
||||
|
||||
|
||||
public FileAttribute getFileAttribute(String url) {
|
||||
String fileName;
|
||||
FileType type;
|
||||
String suffix;
|
||||
String fullFileName = getUrlParameterReg(url, "fullfilename");
|
||||
if (!StringUtils.isEmpty(fullFileName)) {
|
||||
fileName = fullFileName;
|
||||
type = typeFromFileName(fileName);
|
||||
suffix = suffixFromFileName(fileName);
|
||||
} else {
|
||||
fileName = getFileNameFromURL(url);
|
||||
type = typeFromUrl(url);
|
||||
suffix = suffixFromUrl(url);
|
||||
}
|
||||
return new FileAttribute(type,suffix,fileName,url,url);
|
||||
}
|
||||
}
|
||||
57
jodconverter-web/src/main/java/cn/keking/utils/FtpUtils.java
Normal file
57
jodconverter-web/src/main/java/cn/keking/utils/FtpUtils.java
Normal file
@@ -0,0 +1,57 @@
|
||||
package cn.keking.utils;
|
||||
|
||||
import cn.keking.config.ConfigConstants;
|
||||
import org.apache.commons.net.ftp.FTPClient;
|
||||
import org.apache.commons.net.ftp.FTPReply;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.net.URL;
|
||||
|
||||
/**
|
||||
* @auther: chenjh
|
||||
* @since: 2019/6/18 14:36
|
||||
*/
|
||||
public class FtpUtils {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(FtpUtils.class);
|
||||
|
||||
public static FTPClient connect(String host, int port, String username, String password, String controlEncoding) throws IOException {
|
||||
FTPClient ftpClient = new FTPClient();
|
||||
ftpClient.connect(host, port);
|
||||
if (!StringUtils.isEmpty(username) && !StringUtils.isEmpty(password)) {
|
||||
ftpClient.login(username, password);
|
||||
}
|
||||
int reply = ftpClient.getReplyCode();
|
||||
if (!FTPReply.isPositiveCompletion(reply)) {
|
||||
ftpClient.disconnect();
|
||||
}
|
||||
ftpClient.setControlEncoding(controlEncoding);
|
||||
ftpClient.setFileType(FTPClient.BINARY_FILE_TYPE);
|
||||
return ftpClient;
|
||||
}
|
||||
|
||||
public static void download(String ftpUrl, String localFilePath, String ftpUsername, String ftpPassword, String ftpControlEncoding) throws IOException {
|
||||
String username = StringUtils.isEmpty(ftpUsername) ? ConfigConstants.getFtpUsername() : ftpUsername;
|
||||
String password = StringUtils.isEmpty(ftpPassword) ? ConfigConstants.getFtpPassword() : ftpPassword;
|
||||
String controlEncoding = StringUtils.isEmpty(ftpControlEncoding) ? ConfigConstants.getFtpControlEncoding() : ftpControlEncoding;
|
||||
URL url = new URL(ftpUrl);
|
||||
String host = url.getHost();
|
||||
int port = (url.getPort() == -1) ? url.getDefaultPort() : url.getPort();
|
||||
String remoteFilePath = url.getPath();
|
||||
LOGGER.debug("FTP connection url:{}, username:{}, password:{}, controlEncoding:{}, localFilePath:{}", ftpUrl, username, password, controlEncoding, localFilePath);
|
||||
FTPClient ftpClient = connect(host, port, username, password, controlEncoding);
|
||||
OutputStream outputStream = new FileOutputStream(localFilePath);
|
||||
ftpClient.enterLocalPassiveMode();
|
||||
boolean downloadResult = ftpClient.retrieveFile(new String(remoteFilePath.getBytes(controlEncoding), "ISO-8859-1"), outputStream);
|
||||
LOGGER.debug("FTP download result {}", downloadResult);
|
||||
outputStream.flush();
|
||||
outputStream.close();
|
||||
ftpClient.logout();
|
||||
ftpClient.disconnect();
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.yudianbank.utils;
|
||||
package cn.keking.utils;
|
||||
import org.artofsolving.jodconverter.OfficeDocumentConverter;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
66
jodconverter-web/src/main/java/cn/keking/utils/PdfUtils.java
Normal file
66
jodconverter-web/src/main/java/cn/keking/utils/PdfUtils.java
Normal file
@@ -0,0 +1,66 @@
|
||||
package cn.keking.utils;
|
||||
|
||||
import org.apache.pdfbox.pdmodel.PDDocument;
|
||||
import org.apache.pdfbox.rendering.ImageType;
|
||||
import org.apache.pdfbox.rendering.PDFRenderer;
|
||||
import org.apache.pdfbox.tools.imageio.ImageIOUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
public class PdfUtils {
|
||||
|
||||
private final Logger LOGGER = LoggerFactory.getLogger(PdfUtils.class);
|
||||
|
||||
@Autowired
|
||||
FileUtils fileUtils;
|
||||
|
||||
public List<String> pdf2jpg(String pdfFilePath, String pdfName, String url) {
|
||||
List<String> imageUrls = new ArrayList<>();
|
||||
Integer imageCount = fileUtils.getConvertedPdfImage(pdfFilePath);
|
||||
String imageFileSuffix = ".jpg";
|
||||
// https://8个字符 http://7个字符 从这后面开始出现的第一个/就是当前file.Dir下的根目录
|
||||
int index1 = url.indexOf("/", 8);
|
||||
String pdfFolder = pdfName.substring(0, pdfName.length() - 4);
|
||||
String urlPrefix = url.substring(0, index1 + 1) + pdfFolder;
|
||||
if (imageCount != null && imageCount.intValue() > 0) {
|
||||
for (int i = 0; i < imageCount ; i++)
|
||||
imageUrls.add(urlPrefix + "/" + i + imageFileSuffix);
|
||||
return imageUrls;
|
||||
}
|
||||
try {
|
||||
File pdfFile = new File(pdfFilePath);
|
||||
PDDocument doc = PDDocument.load(pdfFile);
|
||||
int pageCount = doc.getNumberOfPages();
|
||||
PDFRenderer pdfRenderer = new PDFRenderer(doc);
|
||||
|
||||
int index = pdfFilePath.lastIndexOf(".");
|
||||
String folder = pdfFilePath.substring(0, index);
|
||||
|
||||
File path = new File(folder);
|
||||
if (!path.exists()) {
|
||||
path.mkdirs();
|
||||
}
|
||||
String imageFilePath;
|
||||
for (int pageIndex = 0; pageIndex < pageCount; pageIndex++) {
|
||||
imageFilePath = folder + File.separator + pageIndex + imageFileSuffix;
|
||||
BufferedImage image = pdfRenderer.renderImageWithDPI(pageIndex, 105, ImageType.RGB);
|
||||
ImageIOUtil.writeImage(image, imageFilePath, 105);
|
||||
imageUrls.add(urlPrefix + "/" + pageIndex + imageFileSuffix);
|
||||
}
|
||||
doc.close();
|
||||
fileUtils.addConvertedPdfImage(pdfFilePath, pageCount);
|
||||
} catch (IOException e) {
|
||||
LOGGER.error("Convert pdf to jpg exception", e);
|
||||
}
|
||||
return imageUrls;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package cn.keking.utils;
|
||||
|
||||
import cn.keking.config.ConfigConstants;
|
||||
import cn.keking.service.cache.CacheService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @auther: chenjh
|
||||
* @since: 2019/6/11 7:45
|
||||
*/
|
||||
@Component
|
||||
@ConditionalOnExpression("'${cache.clean.enabled:false}'.equals('true')")
|
||||
public class ShedulerClean {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(ShedulerClean.class);
|
||||
|
||||
@Autowired
|
||||
private CacheService cacheService;
|
||||
|
||||
private String fileDir = ConfigConstants.getFileDir();
|
||||
|
||||
//默认每晚3点执行一次
|
||||
@Scheduled(cron = "${cache.clean.cron:0 0 3 * * ?}")
|
||||
public void clean() {
|
||||
LOGGER.info("Cache clean start");
|
||||
cacheService.cleanCache();
|
||||
DeleteFileUtil.deleteDirectory(fileDir);
|
||||
LOGGER.info("Cache clean end");
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,9 @@
|
||||
package com.yudianbank.utils;
|
||||
package cn.keking.utils;
|
||||
|
||||
import com.yudianbank.param.ReturnResponse;
|
||||
import cn.keking.config.ConfigConstants;
|
||||
import cn.keking.model.FileAttribute;
|
||||
import cn.keking.model.ReturnResponse;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
@@ -12,13 +13,14 @@ import org.springframework.stereotype.Component;
|
||||
*/
|
||||
@Component
|
||||
public class SimTextUtil {
|
||||
@Value("${file.dir}")
|
||||
String fileDir;
|
||||
@Autowired
|
||||
DownloadUtils downloadUtils;
|
||||
private FileUtils fileUtils;
|
||||
@Autowired
|
||||
private DownloadUtils downloadUtils;
|
||||
|
||||
public ReturnResponse<String> readSimText(String url, String fileName){
|
||||
ReturnResponse<String> response = downloadUtils.downLoad(url, "txt", fileName);
|
||||
FileAttribute fileAttribute = fileUtils.getFileAttribute(url);
|
||||
ReturnResponse<String> response = downloadUtils.downLoad(fileAttribute, fileName);
|
||||
return response;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.yudianbank.utils;
|
||||
package cn.keking.utils;
|
||||
|
||||
import cn.keking.config.ConfigConstants;
|
||||
import cn.keking.model.FileType;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.github.junrar.Archive;
|
||||
@@ -7,16 +9,23 @@ import com.github.junrar.exception.RarException;
|
||||
import com.github.junrar.rarfile.FileHeader;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import org.apache.commons.compress.archivers.sevenz.SevenZArchiveEntry;
|
||||
import org.apache.commons.compress.archivers.sevenz.SevenZFile;
|
||||
import org.apache.commons.compress.archivers.zip.ZipArchiveEntry;
|
||||
import org.apache.commons.compress.archivers.zip.ZipFile;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.context.request.RequestContextHolder;
|
||||
|
||||
import java.io.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.CollationKey;
|
||||
import java.text.Collator;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -25,11 +34,11 @@ import java.util.concurrent.Executors;
|
||||
*/
|
||||
@Component
|
||||
public class ZipReader {
|
||||
static Pattern pattern = Pattern.compile("^\\d+");
|
||||
|
||||
@Autowired
|
||||
FileUtils fileUtils;
|
||||
@Value("${file.dir}")
|
||||
String fileDir;
|
||||
String fileDir = ConfigConstants.getFileDir();
|
||||
|
||||
ExecutorService executors = Executors.newFixedThreadPool(Runtime.getRuntime().availableProcessors());
|
||||
|
||||
@@ -49,9 +58,11 @@ public class ZipReader {
|
||||
* </p>
|
||||
* @param filePath
|
||||
*/
|
||||
public String readZipFile(String filePath) {
|
||||
public String readZipFile(String filePath,String fileKey) {
|
||||
String archiveSeparator = "/";
|
||||
Map<String, FileNode> appender = Maps.newHashMap();
|
||||
List imgUrls=Lists.newArrayList();
|
||||
String baseUrl= (String) RequestContextHolder.currentRequestAttributes().getAttribute("baseUrl",0);
|
||||
String archiveFileName = fileUtils.getFileNameFromPath(filePath);
|
||||
try {
|
||||
ZipFile zipFile = new ZipFile(filePath, fileUtils.getFileEncodeUTFGBK(filePath));
|
||||
@@ -73,12 +84,17 @@ public class ZipReader {
|
||||
}
|
||||
String parentName = getLast2FileName(fullName, archiveSeparator, archiveFileName);
|
||||
parentName = (level-1) + "_" + parentName;
|
||||
FileNode node = new FileNode(originName, childName, parentName, new ArrayList<>(), directory);
|
||||
FileType type=fileUtils.typeFromUrl(childName);
|
||||
if (type.equals(FileType.picture)){//添加图片文件到图片列表
|
||||
imgUrls.add(baseUrl+childName);
|
||||
}
|
||||
FileNode node = new FileNode(originName, childName, parentName, new ArrayList<>(), directory,fileKey);
|
||||
addNodes(appender, parentName, node);
|
||||
appender.put(childName, node);
|
||||
}
|
||||
// 开启新的线程处理文件解压
|
||||
executors.submit(new ZipExtractorWorker(entriesToBeExtracted, zipFile, filePath));
|
||||
fileUtils.setRedisImgUrls(fileKey,imgUrls);
|
||||
return new ObjectMapper().writeValueAsString(appender.get(""));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
@@ -86,6 +102,8 @@ public class ZipReader {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 排序zipEntries(对原来列表倒序)
|
||||
* @param entries
|
||||
@@ -99,10 +117,12 @@ public class ZipReader {
|
||||
return Collections.enumeration(sortedEntries);
|
||||
}
|
||||
|
||||
public String unRar(String filePath){
|
||||
public String unRar(String filePath,String fileKey){
|
||||
Map<String, FileNode> appender = Maps.newHashMap();
|
||||
List imgUrls=Lists.newArrayList();
|
||||
String baseUrl= (String) RequestContextHolder.currentRequestAttributes().getAttribute("baseUrl",0);
|
||||
try {
|
||||
Archive archive = new Archive(new File(filePath));
|
||||
Archive archive = new Archive(new FileInputStream(new File(filePath)));
|
||||
List<FileHeader> headers = archive.getFileHeaders();
|
||||
headers = sortedHeaders(headers);
|
||||
String archiveFileName = fileUtils.getFileNameFromPath(filePath);
|
||||
@@ -123,11 +143,16 @@ public class ZipReader {
|
||||
headersToBeExtracted.add(Collections.singletonMap(childName, header));
|
||||
}
|
||||
String parentName = getLast2FileName(fullName, "\\", archiveFileName);
|
||||
FileNode node = new FileNode(originName, childName, parentName, new ArrayList<>(), directory);
|
||||
FileType type=fileUtils.typeFromUrl(childName);
|
||||
if (type.equals(FileType.picture)){//添加图片文件到图片列表
|
||||
imgUrls.add(baseUrl+childName);
|
||||
}
|
||||
FileNode node = new FileNode(originName, childName, parentName, new ArrayList<>(), directory,fileKey);
|
||||
addNodes(appender, parentName, node);
|
||||
appender.put(childName, node);
|
||||
}
|
||||
executors.submit(new RarExtractorWorker(headersToBeExtracted, archive, filePath));
|
||||
fileUtils.setRedisImgUrls(fileKey,imgUrls);
|
||||
return new ObjectMapper().writeValueAsString(appender.get(""));
|
||||
} catch (RarException e) {
|
||||
e.printStackTrace();
|
||||
@@ -137,9 +162,76 @@ public class ZipReader {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 解压7z文件
|
||||
* @param filePath
|
||||
* @param fileKey
|
||||
* @return
|
||||
*/
|
||||
public String read7zFile(String filePath,String fileKey) {
|
||||
String archiveSeparator = "/";
|
||||
Map<String, FileNode> appender = Maps.newHashMap();
|
||||
List imgUrls=Lists.newArrayList();
|
||||
String baseUrl= (String) RequestContextHolder.currentRequestAttributes().getAttribute("baseUrl",0);
|
||||
String archiveFileName = fileUtils.getFileNameFromPath(filePath);
|
||||
try {
|
||||
SevenZFile zipFile = new SevenZFile(new File(filePath));
|
||||
Iterable<SevenZArchiveEntry> entries = zipFile.getEntries();
|
||||
// 排序
|
||||
Enumeration<SevenZArchiveEntry> newEntries = sortSevenZEntries(entries);
|
||||
List<Map<String, SevenZArchiveEntry>> entriesToBeExtracted = Lists.newArrayList();
|
||||
while (newEntries.hasMoreElements()){
|
||||
SevenZArchiveEntry entry = newEntries.nextElement();
|
||||
String fullName = entry.getName();
|
||||
int level = fullName.split(archiveSeparator).length;
|
||||
// 展示名
|
||||
String originName = getLastFileName(fullName, archiveSeparator);
|
||||
String childName = level + "_" + originName;
|
||||
boolean directory = entry.isDirectory();
|
||||
if (!directory) {
|
||||
childName = archiveFileName + "_" + originName;
|
||||
entriesToBeExtracted.add(Collections.singletonMap(childName, entry));
|
||||
}
|
||||
String parentName = getLast2FileName(fullName, archiveSeparator, archiveFileName);
|
||||
parentName = (level-1) + "_" + parentName;
|
||||
FileType type=fileUtils.typeFromUrl(childName);
|
||||
if (type.equals(FileType.picture)){//添加图片文件到图片列表
|
||||
imgUrls.add(baseUrl+childName);
|
||||
}
|
||||
FileNode node = new FileNode(originName, childName, parentName, new ArrayList<>(), directory,fileKey);
|
||||
addNodes(appender, parentName, node);
|
||||
appender.put(childName, node);
|
||||
}
|
||||
// 开启新的线程处理文件解压
|
||||
executors.submit(new SevenZExtractorWorker(entriesToBeExtracted, filePath));
|
||||
fileUtils.setRedisImgUrls(fileKey,imgUrls);
|
||||
return new ObjectMapper().writeValueAsString(appender.get(""));
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 排序7ZEntries(对原来列表倒序)
|
||||
* @param entries
|
||||
*/
|
||||
private Enumeration<SevenZArchiveEntry> sortSevenZEntries(Iterable<SevenZArchiveEntry> entries) {
|
||||
List<SevenZArchiveEntry> sortedEntries = Lists.newArrayList();
|
||||
Iterator<SevenZArchiveEntry> iterator = entries.iterator();
|
||||
while(iterator.hasNext()){
|
||||
sortedEntries.add(iterator.next());
|
||||
}
|
||||
// Collections.sort(sortedEntries, Comparator.comparingInt(o -> o.getName().length()));
|
||||
return Collections.enumeration(sortedEntries);
|
||||
}
|
||||
|
||||
private void addNodes(Map<String, FileNode> appender, String parentName, FileNode node) {
|
||||
if (appender.containsKey(parentName)) {
|
||||
appender.get(parentName).getChildList().add(node);
|
||||
Collections.sort(appender.get(parentName).getChildList(), sortComparator);
|
||||
// appender.get(parentName).getChildList().sort((final FileNode h1, final FileNode h2) -> h1.getOriginName().compareTo(h2.getOriginName()));//排序
|
||||
}else { // 根节点
|
||||
FileNode nodeRoot = new FileNode(parentName, parentName, "", new ArrayList<>(), true);
|
||||
nodeRoot.getChildList().add(node);
|
||||
@@ -151,10 +243,10 @@ public class ZipReader {
|
||||
private List<FileHeader> sortedHeaders(List<FileHeader> headers) {
|
||||
List<FileHeader> sortedHeaders = new ArrayList<>();
|
||||
Map<Integer, FileHeader> mapHeaders = new TreeMap<>();
|
||||
headers.forEach(header -> mapHeaders.put(header.getFileNameW().length(), header));
|
||||
headers.forEach(header -> mapHeaders.put(new Integer(0).equals(header.getFileNameW().length()) ? header.getFileNameString().length() : header.getFileNameW().length(), header));
|
||||
for (Map.Entry<Integer, FileHeader> entry : mapHeaders.entrySet()){
|
||||
for (FileHeader header : headers) {
|
||||
if (entry.getKey().intValue() == header.getFileNameW().length()) {
|
||||
if (entry.getKey().equals(new Integer(0).equals(header.getFileNameW().length()) ? header.getFileNameString().length() : header.getFileNameW().length())) {
|
||||
sortedHeaders.add(header);
|
||||
}
|
||||
}
|
||||
@@ -204,6 +296,30 @@ public class ZipReader {
|
||||
return newName;
|
||||
}
|
||||
|
||||
public static Comparator<FileNode> sortComparator = new Comparator<FileNode>() {
|
||||
Collator cmp = Collator.getInstance(Locale.US);
|
||||
@Override
|
||||
public int compare(FileNode o1, FileNode o2) {
|
||||
// 判断两个对比对象是否是开头包含数字,如果包含数字则获取数字并按数字真正大小进行排序
|
||||
BigDecimal num1,num2;
|
||||
if (null != (num1 = isStartNumber(o1))
|
||||
&& null != (num2 = isStartNumber(o2))) {
|
||||
return num1.subtract(num2).intValue();
|
||||
}
|
||||
CollationKey c1 = cmp.getCollationKey(o1.getOriginName());
|
||||
CollationKey c2 = cmp.getCollationKey(o2.getOriginName());
|
||||
return cmp.compare(c1.getSourceString(), c2.getSourceString());
|
||||
}
|
||||
};
|
||||
|
||||
private static BigDecimal isStartNumber(FileNode src) {
|
||||
Matcher matcher = pattern.matcher(src.getOriginName());
|
||||
if (matcher.find()) {
|
||||
return new BigDecimal(matcher.group());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 文件节点(区分文件上下级)
|
||||
*/
|
||||
@@ -213,9 +329,12 @@ public class ZipReader {
|
||||
private String fileName;
|
||||
private String parentFileName;
|
||||
private boolean directory;
|
||||
|
||||
private String fileKey;//用于图片预览时寻址
|
||||
private List<FileNode> childList;
|
||||
|
||||
public FileNode() {
|
||||
}
|
||||
|
||||
public FileNode(String originName, String fileName, String parentFileName, List<FileNode> childList, boolean directory) {
|
||||
this.originName = originName;
|
||||
this.fileName = fileName;
|
||||
@@ -223,6 +342,21 @@ public class ZipReader {
|
||||
this.childList = childList;
|
||||
this.directory = directory;
|
||||
}
|
||||
public FileNode(String originName, String fileName, String parentFileName, List<FileNode> childList, boolean directory,String fileKey) {
|
||||
this.originName = originName;
|
||||
this.fileName = fileName;
|
||||
this.parentFileName = parentFileName;
|
||||
this.childList = childList;
|
||||
this.directory = directory;
|
||||
this.fileKey=fileKey;
|
||||
}
|
||||
public String getFileKey() {
|
||||
return fileKey;
|
||||
}
|
||||
|
||||
public void setFileKey(String fileKey) {
|
||||
this.fileKey = fileKey;
|
||||
}
|
||||
|
||||
public String getFileName() {
|
||||
return fileName;
|
||||
@@ -335,6 +469,60 @@ public class ZipReader {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 7z文件抽取线程
|
||||
*/
|
||||
class SevenZExtractorWorker implements Runnable {
|
||||
|
||||
private List<Map<String, SevenZArchiveEntry>> entriesToBeExtracted;
|
||||
private String filePath;
|
||||
|
||||
public SevenZExtractorWorker(List<Map<String, SevenZArchiveEntry>> entriesToBeExtracted, String filePath) {
|
||||
this.entriesToBeExtracted = entriesToBeExtracted;
|
||||
this.filePath = filePath;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
System.out.println("解析压缩文件开始《《《《《《《《《《《《《《《《《《《《《《《");
|
||||
try {
|
||||
SevenZFile sevenZFile = new SevenZFile(new File(filePath));
|
||||
SevenZArchiveEntry entry = sevenZFile.getNextEntry();
|
||||
while (entry != null) {
|
||||
if (entry.isDirectory()) {
|
||||
entry = sevenZFile.getNextEntry();
|
||||
continue;
|
||||
}
|
||||
String childName = "default_file";
|
||||
SevenZArchiveEntry entry1 = null;
|
||||
for (Map<String, SevenZArchiveEntry> entryMap : entriesToBeExtracted) {
|
||||
childName = entryMap.keySet().iterator().next();
|
||||
entry1 = entryMap.values().iterator().next();
|
||||
if (entry.getName().equals(entry1.getName())) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
FileOutputStream out = new FileOutputStream(fileDir + childName);
|
||||
byte[] content = new byte[(int) entry.getSize()];
|
||||
sevenZFile.read(content, 0, content.length);
|
||||
out.write(content);
|
||||
out.close();
|
||||
entry = sevenZFile.getNextEntry();
|
||||
}
|
||||
sevenZFile.close();
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (new File(filePath).exists()) {
|
||||
new File(filePath).delete();
|
||||
}
|
||||
System.out.println("解析压缩文件结束《《《《《《《《《《《《《《《《《《《《《《《");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Rar文件抽取
|
||||
*/
|
||||
@@ -1,13 +1,13 @@
|
||||
package com.yudianbank.web.controller;
|
||||
package cn.keking.web.controller;
|
||||
|
||||
import cn.keking.config.ConfigConstants;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.yudianbank.param.ReturnResponse;
|
||||
import com.yudianbank.utils.FileUtils;
|
||||
import cn.keking.model.ReturnResponse;
|
||||
import cn.keking.utils.FileUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
@@ -28,8 +28,7 @@ import java.util.UUID;
|
||||
*/
|
||||
@RestController
|
||||
public class FileController {
|
||||
@Value("${file.dir}")
|
||||
String fileDir;
|
||||
String fileDir = ConfigConstants.getFileDir();
|
||||
@Autowired
|
||||
FileUtils fileUtils;
|
||||
String demoDir = "demo";
|
||||
@@ -38,7 +37,19 @@ public class FileController {
|
||||
@RequestMapping(value = "fileUpload", method = RequestMethod.POST)
|
||||
public String fileUpload(@RequestParam("file") MultipartFile file,
|
||||
HttpServletRequest request) throws JsonProcessingException {
|
||||
// 获取文件名
|
||||
String fileName = file.getOriginalFilename();
|
||||
//判断是否为IE浏览器的文件名,IE浏览器下文件名会带有盘符信息
|
||||
// Check for Unix-style path
|
||||
int unixSep = fileName.lastIndexOf('/');
|
||||
// Check for Windows-style path
|
||||
int winSep = fileName.lastIndexOf('\\');
|
||||
// Cut off at latest possible point
|
||||
int pos = (winSep > unixSep ? winSep : unixSep);
|
||||
if (pos != -1) {
|
||||
fileName = fileName.substring(pos + 1);
|
||||
}
|
||||
|
||||
// 判断该文件类型是否有上传过,如果上传过则提示不允许再次上传
|
||||
if (existsTypeFile(fileName)) {
|
||||
return new ObjectMapper().writeValueAsString(new ReturnResponse<String>(1, "每一种类型只可以上传一个文件,请先删除原有文件再次上传", null));
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.yudianbank.web.controller;
|
||||
package cn.keking.web.controller;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@@ -0,0 +1,140 @@
|
||||
package cn.keking.web.controller;
|
||||
|
||||
import cn.keking.config.ConfigConstants;
|
||||
import cn.keking.model.FileAttribute;
|
||||
import cn.keking.service.FilePreview;
|
||||
import cn.keking.service.FilePreviewFactory;
|
||||
|
||||
import cn.keking.service.cache.CacheService;
|
||||
import cn.keking.utils.FileUtils;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author yudian-it
|
||||
*/
|
||||
@Controller
|
||||
public class OnlinePreviewController {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(OnlinePreviewController.class);
|
||||
|
||||
@Autowired
|
||||
FilePreviewFactory previewFactory;
|
||||
|
||||
@Autowired
|
||||
CacheService cacheService;
|
||||
|
||||
@Autowired
|
||||
private FileUtils fileUtils;
|
||||
|
||||
private String fileDir = ConfigConstants.getFileDir();
|
||||
|
||||
/**
|
||||
* @param url
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "onlinePreview", method = RequestMethod.GET)
|
||||
public String onlinePreview(String url, Model model, HttpServletRequest req) {
|
||||
FileAttribute fileAttribute = fileUtils.getFileAttribute(url);
|
||||
req.setAttribute("fileKey", req.getParameter("fileKey"));
|
||||
model.addAttribute("officePreviewType", req.getParameter("officePreviewType"));
|
||||
model.addAttribute("originUrl", req.getRequestURL().toString());
|
||||
FilePreview filePreview = previewFactory.get(fileAttribute);
|
||||
return filePreview.filePreviewHandle(url, model, fileAttribute);
|
||||
}
|
||||
|
||||
/**
|
||||
* 多图片切换预览
|
||||
*
|
||||
* @param model
|
||||
* @param req
|
||||
* @return
|
||||
* @throws UnsupportedEncodingException
|
||||
*/
|
||||
@RequestMapping(value = "picturesPreview", method = RequestMethod.GET)
|
||||
public String picturesPreview(String urls, String currentUrl, Model model, HttpServletRequest req) throws UnsupportedEncodingException {
|
||||
// 路径转码
|
||||
String decodedUrl = URLDecoder.decode(urls, "utf-8");
|
||||
String decodedCurrentUrl = URLDecoder.decode(currentUrl, "utf-8");
|
||||
// 抽取文件并返回文件列表
|
||||
String[] imgs = decodedUrl.split("\\|");
|
||||
List imgurls = Arrays.asList(imgs);
|
||||
model.addAttribute("imgurls", imgurls);
|
||||
model.addAttribute("currentUrl",decodedCurrentUrl);
|
||||
return "picture";
|
||||
}
|
||||
|
||||
@RequestMapping(value = "picturesPreview", method = RequestMethod.POST)
|
||||
public String picturesPreview(Model model, HttpServletRequest req) throws UnsupportedEncodingException {
|
||||
String urls = req.getParameter("urls");
|
||||
String currentUrl = req.getParameter("currentUrl");
|
||||
// 路径转码
|
||||
String decodedUrl = URLDecoder.decode(urls, "utf-8");
|
||||
String decodedCurrentUrl = URLDecoder.decode(currentUrl, "utf-8");
|
||||
// 抽取文件并返回文件列表
|
||||
String[] imgs = decodedUrl.split("\\|");
|
||||
List imgurls = Arrays.asList(imgs);
|
||||
model.addAttribute("imgurls", imgurls);
|
||||
model.addAttribute("currentUrl",decodedCurrentUrl);
|
||||
return "picture";
|
||||
}
|
||||
/**
|
||||
* 根据url获取文件内容
|
||||
* 当pdfjs读取存在跨域问题的文件时将通过此接口读取
|
||||
*
|
||||
* @param urlPath
|
||||
* @param resp
|
||||
*/
|
||||
@RequestMapping(value = "/getCorsFile", method = RequestMethod.GET)
|
||||
public void getCorsFile(String urlPath, HttpServletResponse resp) {
|
||||
InputStream inputStream = null;
|
||||
try {
|
||||
String strUrl = urlPath.trim();
|
||||
URL url = new URL(new URI(strUrl).toASCIIString());
|
||||
//打开请求连接
|
||||
URLConnection connection = url.openConnection();
|
||||
HttpURLConnection httpURLConnection = (HttpURLConnection) connection;
|
||||
httpURLConnection.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)");
|
||||
inputStream = httpURLConnection.getInputStream();
|
||||
byte[] bs = new byte[1024];
|
||||
int len;
|
||||
while (-1 != (len = inputStream.read(bs))) {
|
||||
resp.getOutputStream().write(bs, 0, len);
|
||||
}
|
||||
} catch (IOException | URISyntaxException e) {
|
||||
LOGGER.error("下载pdf文件失败", e);
|
||||
} finally {
|
||||
if (inputStream != null) {
|
||||
IOUtils.closeQuietly(inputStream);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过api接口入队
|
||||
* @param url 请编码后在入队
|
||||
*/
|
||||
@GetMapping("/addTask")
|
||||
@ResponseBody
|
||||
public String addQueueTask(String url) {
|
||||
cacheService.addQueueTask(url);
|
||||
return "success";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,33 +0,0 @@
|
||||
package com.yudianbank.filters;
|
||||
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author yudian-it
|
||||
* @date 2017/11/30
|
||||
*/
|
||||
public class ChinesePathFilter implements Filter {
|
||||
|
||||
@Override
|
||||
public void init(FilterConfig filterConfig) throws ServletException {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
|
||||
request.setCharacterEncoding("UTF-8");
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
StringBuilder pathBuilder = new StringBuilder();
|
||||
pathBuilder.append(request.getScheme()).append("://").append(request.getServerName()).append(":")
|
||||
.append(request.getServerPort()).append(((HttpServletRequest)request).getContextPath()).append("/");
|
||||
request.setAttribute("baseUrl", pathBuilder.toString());
|
||||
chain.doFilter(request, response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,192 +0,0 @@
|
||||
package com.yudianbank.utils;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import org.redisson.api.RMapCache;
|
||||
import org.redisson.api.RedissonClient;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author yudian-it
|
||||
* @date 2017/11/13
|
||||
*/
|
||||
@Component
|
||||
public class FileUtils {
|
||||
|
||||
final String REDIS_FILE_PREVIEW_PDF_KEY = "converted-preview-pdf-file";
|
||||
|
||||
@Autowired
|
||||
RedissonClient redissonClient;
|
||||
@Value("${file.dir}")
|
||||
String fileDir;
|
||||
|
||||
@Value("${converted.file.charset}")
|
||||
String charset;
|
||||
|
||||
/**
|
||||
* 已转换过的文件集合(redis缓存)
|
||||
* @return
|
||||
*/
|
||||
public Map<String, String> listConvertedFiles() {
|
||||
RMapCache<String, String> convertedList = redissonClient.getMapCache(REDIS_FILE_PREVIEW_PDF_KEY);
|
||||
return convertedList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 已转换过的文件,根据文件名获取
|
||||
* @return
|
||||
*/
|
||||
public String getConvertedFile(String key) {
|
||||
RMapCache<String, String> convertedList = redissonClient.getMapCache(REDIS_FILE_PREVIEW_PDF_KEY);
|
||||
return convertedList.get(key);
|
||||
}
|
||||
|
||||
/**
|
||||
* 从url中剥离出文件名
|
||||
* @param url
|
||||
* 格式如:http://keking.ufile.ucloud.com.cn/20171113164107_月度绩效表模板(新).xls?UCloudPublicKey=ucloudtangshd@weifenf.com14355492830001993909323&Expires=&Signature=I D1NOFtAJSPT16E6imv6JWuq0k=
|
||||
* @return
|
||||
*/
|
||||
public String getFileNameFromURL(String url) {
|
||||
// 因为url的参数中可能会存在/的情况,所以直接url.lastIndexOf("/")会有问题
|
||||
// 所以先从?处将url截断,然后运用url.lastIndexOf("/")获取文件名
|
||||
String noQueryUrl = url.substring(0, url.indexOf("?") != -1 ? url.indexOf("?"): url.length());
|
||||
String fileName = noQueryUrl.substring(noQueryUrl.lastIndexOf("/") + 1);
|
||||
return fileName;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文件后缀
|
||||
* @param fileName
|
||||
* @return
|
||||
*/
|
||||
public String getSuffixFromFileName(String fileName) {
|
||||
String suffix = fileName.substring(fileName.lastIndexOf("."));
|
||||
return suffix;
|
||||
}
|
||||
|
||||
/**
|
||||
* 从路径中获取
|
||||
* @param path
|
||||
* 类似这种:C:\Users\yudian-it\Downloads
|
||||
* @return
|
||||
*/
|
||||
public String getFileNameFromPath(String path) {
|
||||
return path.substring(path.lastIndexOf(File.separator) + 1);
|
||||
}
|
||||
|
||||
public List<String> listPictureTypes(){
|
||||
List<String> list = Lists.newArrayList();
|
||||
list.add("jpg");
|
||||
list.add("jpeg");
|
||||
list.add("png");
|
||||
list.add("gif");
|
||||
list.add("bmp");
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<String> listArchiveTypes(){
|
||||
List<String> list = Lists.newArrayList();
|
||||
list.add("rar");
|
||||
list.add("zip");
|
||||
list.add("jar");
|
||||
list.add("7-zip");
|
||||
list.add("tar");
|
||||
list.add("gzip");
|
||||
list.add("7z");
|
||||
return list;
|
||||
}
|
||||
|
||||
public List<String> listOfficeTypes() {
|
||||
List<String> list = Lists.newArrayList();
|
||||
list.add("docx");
|
||||
list.add("doc");
|
||||
list.add("xls");
|
||||
list.add("xlsx");
|
||||
list.add("ppt");
|
||||
list.add("pptx");
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取相对路径
|
||||
* @param absolutePath
|
||||
* @return
|
||||
*/
|
||||
public String getRelativePath(String absolutePath) {
|
||||
return absolutePath.substring(fileDir.length());
|
||||
}
|
||||
|
||||
public void addConvertedFile(String fileName, String value){
|
||||
RMapCache<String, String> convertedList = redissonClient.getMapCache(REDIS_FILE_PREVIEW_PDF_KEY);
|
||||
convertedList.fastPut(fileName, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断文件编码格式
|
||||
* @param path
|
||||
* @return
|
||||
*/
|
||||
public String getFileEncodeUTFGBK(String path){
|
||||
String enc = Charset.forName("GBK").name();
|
||||
File file = new File(path);
|
||||
InputStream in= null;
|
||||
try {
|
||||
in = new FileInputStream(file);
|
||||
byte[] b = new byte[3];
|
||||
in.read(b);
|
||||
in.close();
|
||||
if (b[0] == -17 && b[1] == -69 && b[2] == -65) {
|
||||
enc = Charset.forName("UTF-8").name();
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
System.out.println("文件编码格式为:" + enc);
|
||||
return enc;
|
||||
}
|
||||
|
||||
/**
|
||||
* 对转换后的文件进行操作(改变编码方式)
|
||||
* @param outFilePath
|
||||
*/
|
||||
public void doActionConvertedFile(String outFilePath) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
try (InputStream inputStream = new FileInputStream(outFilePath);
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream, charset))){
|
||||
String line;
|
||||
while(null != (line = reader.readLine())){
|
||||
if (line.contains("charset=gb2312")) {
|
||||
line = line.replace("charset=gb2312", "charset=utf-8");
|
||||
}
|
||||
sb.append(line);
|
||||
}
|
||||
// 添加sheet控制头
|
||||
sb.append("<script src=\"js/jquery-3.0.0.min.js\" type=\"text/javascript\"></script>");
|
||||
sb.append("<script src=\"js/excel.header.js\" type=\"text/javascript\"></script>");
|
||||
sb.append("<link rel=\"stylesheet\" href=\"http://cdn.static.runoob.com/libs/bootstrap/3.3.7/css/bootstrap.min.css\">");
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
// 重新写入文件
|
||||
try(FileOutputStream fos = new FileOutputStream(outFilePath);
|
||||
BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(fos))){
|
||||
writer.write(sb.toString());
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,194 +0,0 @@
|
||||
package com.yudianbank.utils;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
import javax.xml.transform.OutputKeys;
|
||||
import javax.xml.transform.Transformer;
|
||||
import javax.xml.transform.TransformerException;
|
||||
import javax.xml.transform.TransformerFactory;
|
||||
import javax.xml.transform.dom.DOMSource;
|
||||
import javax.xml.transform.stream.StreamResult;
|
||||
|
||||
import org.apache.poi.hssf.converter.ExcelToHtmlConverter;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.hwpf.converter.PicturesManager;
|
||||
import org.apache.poi.hwpf.converter.WordToHtmlConverter;
|
||||
import org.apache.poi.hwpf.usermodel.Picture;
|
||||
import org.apache.poi.hwpf.usermodel.PictureType;
|
||||
import org.apache.poi.ss.usermodel.Cell;
|
||||
import org.apache.poi.ss.usermodel.Row;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.ss.usermodel.Workbook;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.w3c.dom.Document;
|
||||
|
||||
|
||||
public class PoiExcelToHtml {
|
||||
// String path = getClass().getClassLoader().getResource(".").getPath()+File.separator+"static"+File.separator;
|
||||
public static void excelConvert(URL url) {
|
||||
try {
|
||||
String path = "";
|
||||
|
||||
// http://keking.ufile.ucloud.com.cn/20171101152525_左晓晖2017年9.xls?UCloudPublicKey=ucloudtangshd@weifenf.com14355492830001993909323&Expires=&Signature=1n8ASiYMcfiF30YHxwpzwfqmlM0=
|
||||
// URL url = new URL("http://keking.ufile.ucloud.com.cn/20171101150322_运费贷信审资料(给予客户收集版).xlsx?UCloudPublicKey=ucloudtangshd@weifenf.com14355492830001993909323&Expires=&Signature=RRVFIICITMNFed1LQgB10WdKHiE=");
|
||||
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
|
||||
//设置超时间为3秒
|
||||
conn.setConnectTimeout(3*1000);
|
||||
//防止屏蔽程序抓取而返回403错误
|
||||
conn.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)");
|
||||
//得到输入流
|
||||
InputStream inputStream = conn.getInputStream();
|
||||
HSSFWorkbook excelBook = new HSSFWorkbook(inputStream);
|
||||
ExcelToHtmlConverter excelToHtmlConverter = new ExcelToHtmlConverter(DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument());
|
||||
excelToHtmlConverter.processWorkbook(excelBook);
|
||||
List pics = excelBook.getAllPictures();
|
||||
if (pics != null) {
|
||||
for (int i = 0; i < pics.size(); i++) {
|
||||
Picture pic = (Picture) pics.get(i);
|
||||
try {
|
||||
pic.writeImageContent(new FileOutputStream(path + pic.suggestFullFileName()));
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
Document htmlDocument = excelToHtmlConverter.getDocument();
|
||||
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
|
||||
DOMSource domSource = new DOMSource(htmlDocument);
|
||||
StreamResult streamResult = new StreamResult(outStream);
|
||||
TransformerFactory tf = TransformerFactory.newInstance();
|
||||
Transformer serializer = tf.newTransformer();
|
||||
serializer.setOutputProperty(OutputKeys.ENCODING, "utf-8");
|
||||
serializer.setOutputProperty(OutputKeys.INDENT, "yes");
|
||||
serializer.setOutputProperty(OutputKeys.METHOD, "html");
|
||||
serializer.transform(domSource, streamResult);
|
||||
outStream.close();
|
||||
|
||||
String content = new String(outStream.toByteArray());
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} catch (ParserConfigurationException e) {
|
||||
e.printStackTrace();
|
||||
} catch (TransformerException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* excel07转html
|
||||
* filename:要读取的文件所在文件夹
|
||||
* filepath:文件名
|
||||
* htmlname:生成html名称
|
||||
* path:html存放路径
|
||||
* */
|
||||
public static void excelToHtml () throws Exception{
|
||||
String htmlname="exportExcel"+"07Test"+".html";
|
||||
|
||||
|
||||
URL url = new URL("http://keking.ufile.ucloud.com.cn/20171101150322_运费贷信审资料(给予客户收集版).xlsx?UCloudPublicKey=ucloudtangshd@weifenf.com14355492830001993909323&Expires=&Signature=RRVFIICITMNFed1LQgB10WdKHiE=");
|
||||
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
|
||||
//设置超时间为3秒
|
||||
conn.setConnectTimeout(3*1000);
|
||||
//防止屏蔽程序抓取而返回403错误
|
||||
conn.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)");
|
||||
//得到输入流
|
||||
InputStream is = conn.getInputStream();
|
||||
|
||||
Workbook workbook = null;
|
||||
// InputStream is = new FileInputStream(filename+"/"+filepath);
|
||||
try {
|
||||
String html="";
|
||||
workbook = new XSSFWorkbook(is);
|
||||
for (int numSheet = 0; numSheet < workbook.getNumberOfSheets(); numSheet++) {
|
||||
Sheet sheet = workbook.getSheetAt(numSheet);
|
||||
if (sheet == null) {
|
||||
continue;
|
||||
}
|
||||
html+="=======================" + sheet.getSheetName() + "=========================<br><br>";
|
||||
|
||||
int firstRowIndex = sheet.getFirstRowNum();
|
||||
int lastRowIndex = sheet.getLastRowNum();
|
||||
html+="<table border='1' align='left'>";
|
||||
Row firstRow = sheet.getRow(firstRowIndex);
|
||||
for (int i = firstRow.getFirstCellNum(); i <= firstRow.getLastCellNum(); i++) {
|
||||
Cell cell = firstRow.getCell(i);
|
||||
String cellValue = getCellValue(cell, true);
|
||||
html+="<th>" + cellValue + "</th>";
|
||||
}
|
||||
|
||||
|
||||
//行
|
||||
for (int rowIndex = firstRowIndex + 1; rowIndex <= lastRowIndex; rowIndex++) {
|
||||
Row currentRow = sheet.getRow(rowIndex);
|
||||
html+="<tr>";
|
||||
if(currentRow!=null){
|
||||
|
||||
int firstColumnIndex = currentRow.getFirstCellNum();
|
||||
int lastColumnIndex = currentRow.getLastCellNum();
|
||||
//列
|
||||
for (int columnIndex = firstColumnIndex; columnIndex <= lastColumnIndex; columnIndex++) {
|
||||
Cell currentCell = currentRow.getCell(columnIndex);
|
||||
String currentCellValue = getCellValue(currentCell, true);
|
||||
html+="<td>"+currentCellValue + "</td>";
|
||||
}
|
||||
}else{
|
||||
html+=" ";
|
||||
}
|
||||
html+="</tr>";
|
||||
}
|
||||
html+="</table>";
|
||||
|
||||
|
||||
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
|
||||
DOMSource domSource = new DOMSource ();
|
||||
StreamResult streamResult = new StreamResult (outStream);
|
||||
|
||||
TransformerFactory tf = TransformerFactory.newInstance();
|
||||
Transformer serializer = tf.newTransformer();
|
||||
serializer.setOutputProperty (OutputKeys.ENCODING, "utf-8");
|
||||
serializer.setOutputProperty (OutputKeys.INDENT, "yes");
|
||||
serializer.setOutputProperty (OutputKeys.METHOD, "html");
|
||||
serializer.transform (domSource, streamResult);
|
||||
outStream.close();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取单元格
|
||||
*
|
||||
*/
|
||||
private static String getCellValue(Cell cell, boolean treatAsStr) {
|
||||
if (cell == null) {
|
||||
return "";
|
||||
}
|
||||
|
||||
if (treatAsStr) {
|
||||
cell.setCellType(Cell.CELL_TYPE_STRING);
|
||||
}
|
||||
|
||||
if (cell.getCellType() == Cell.CELL_TYPE_BOOLEAN) {
|
||||
return String.valueOf(cell.getBooleanCellValue());
|
||||
} else if (cell.getCellType() == Cell.CELL_TYPE_NUMERIC) {
|
||||
return String.valueOf(cell.getNumericCellValue());
|
||||
} else {
|
||||
return String.valueOf(cell.getStringCellValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
package com.yudianbank.utils;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class ShedulerClean {
|
||||
@Value("${file.dir}")
|
||||
String fileDir;
|
||||
|
||||
// @Scheduled(cron = "0 0 23 * * ?") //每晚23点执行一次
|
||||
public void clean(){
|
||||
System.out.println("执行一次清空文件夹");
|
||||
DeleteFileUtil.deleteDirectory(fileDir);
|
||||
}
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
package com.yudianbank.utils;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.URLDecoder;
|
||||
import java.net.URLEncoder;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.ToDoubleFunction;
|
||||
import java.util.function.ToIntFunction;
|
||||
import java.util.function.ToLongFunction;
|
||||
|
||||
import com.github.junrar.Archive;
|
||||
import com.github.junrar.exception.RarException;
|
||||
import com.github.junrar.rarfile.FileHeader;
|
||||
import org.apache.commons.compress.archivers.ArchiveException;
|
||||
import org.apache.commons.compress.archivers.zip.ZipArchiveInputStream;
|
||||
import org.apache.commons.compress.archivers.zip.ZipFile;
|
||||
import org.apache.poi.xwpf.converter.core.FileImageExtractor;
|
||||
import org.apache.poi.xwpf.converter.core.FileURIResolver;
|
||||
import org.apache.poi.xwpf.converter.xhtml.XHTMLConverter;
|
||||
import org.apache.poi.xwpf.converter.xhtml.XHTMLOptions;
|
||||
import org.apache.poi.xwpf.usermodel.XWPFDocument;
|
||||
|
||||
public class WordToHtml {
|
||||
/** 这是2007版本 转html 已测试成功的代码 07和03版要用两种代码转 但因为后面说要用
|
||||
* 38 * 2007版本word转换成html
|
||||
* 39 * @throws IOException
|
||||
* 40
|
||||
*/
|
||||
|
||||
public static String Word2007ToHtml(InputStream inputStream) throws IOException {
|
||||
// 1) 加载word文档生成 XWPFDocument对象
|
||||
XWPFDocument document = new XWPFDocument(inputStream);
|
||||
|
||||
// 2) 解析 XHTML配置 (这里设置IURIResolver来设置图片存放的目录)
|
||||
// File imageFolderFile = new File("/Users/zuoxiaohui/IdeaProjects/yudian-preview-boot/yudian-preview-boot/src/main/resources/picture/");
|
||||
File imageFolderFile = new File("/Users/zuoxiaohui/IdeaProjects/yudian-preview-boot/yudian-preview-boot/src/main/resources/static/");
|
||||
XHTMLOptions options = XHTMLOptions.create().URIResolver(new FileURIResolver(imageFolderFile));
|
||||
options.setExtractor(new FileImageExtractor(imageFolderFile));
|
||||
options.setIgnoreStylesIfUnused(false);
|
||||
options.setFragment(true);
|
||||
|
||||
File file = new File("/Users/zuoxiaohui/Test/" + "test.html");
|
||||
// 3) 将 XWPFDocument转换成XHTML
|
||||
OutputStream out = new FileOutputStream(file);
|
||||
XHTMLConverter.getInstance().convert(document, out, options);
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
XHTMLConverter.getInstance().convert(document, baos, options);
|
||||
String content = baos.toString();
|
||||
System.out.println(content);
|
||||
baos.close();
|
||||
return content;
|
||||
|
||||
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws IOException, ArchiveException, RarException {
|
||||
System.out.println(URLEncoder.encode(" ", "UTF-8"));
|
||||
System.out.println(URLDecoder.decode(" http://keking.ufile.ucloud.com.cn/20171230213253_2017%E5%B9%B4%20%E5%BA%A6%E7%BB%A9%E6%95%88%E8%80%83%E6%A0%B8%E8%A1%A8%E5%8F%8A%E8%AF%84%E4%BC%98%E6%8E%A8%E8%8D%90%E8%A1%A8.xlsxUCloudPublicKey=ucloudtangshd@weifenf.com14355492830001993909323&Expires=&Signature=Pbi/J6UcOZcvGwhAwExe3SpxrGo=", "UTF-8"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,205 +0,0 @@
|
||||
package com.yudianbank.web.controller;
|
||||
|
||||
import com.yudianbank.param.ReturnResponse;
|
||||
import com.yudianbank.utils.*;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.util.StringUtils;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.net.URLConnection;
|
||||
import java.net.URLDecoder;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* @author yudian-it
|
||||
*/
|
||||
@Controller
|
||||
public class OnlinePreviewController {
|
||||
@Autowired
|
||||
private OfficeToPdf officeToPdf;
|
||||
@Autowired
|
||||
FileUtils fileUtils;
|
||||
@Autowired
|
||||
DownloadUtils downloadUtils;
|
||||
@Autowired
|
||||
ZipReader zipReader;
|
||||
@Autowired
|
||||
SimTextUtil simTextUtil;
|
||||
@Value("${simText}")
|
||||
String[] simText;
|
||||
|
||||
@Value("${file.dir}")
|
||||
String fileDir;
|
||||
|
||||
/**
|
||||
* @param url
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
@RequestMapping(value = "onlinePreview",method = RequestMethod.GET)
|
||||
public String onlinePreview(String url, Model model, HttpServletRequest req) throws UnsupportedEncodingException {
|
||||
// 路径转码
|
||||
String decodedUrl = URLDecoder.decode(url, "utf-8");
|
||||
String type = typeFromUrl(url);
|
||||
String suffix = suffixFromUrl(url);
|
||||
// 抽取文件并返回文件列表
|
||||
String fileName = fileUtils.getFileNameFromURL(decodedUrl);
|
||||
model.addAttribute("fileType", suffix);
|
||||
if (type.equalsIgnoreCase("picture")) {
|
||||
model.addAttribute("imgurl", url);
|
||||
return "picture";
|
||||
} else if (type.equalsIgnoreCase("simText")){
|
||||
ReturnResponse<String> response = simTextUtil.readSimText(decodedUrl, fileName);
|
||||
if (0 != response.getCode()) {
|
||||
model.addAttribute("msg", response.getMsg());
|
||||
return "fileNotSupported";
|
||||
}
|
||||
model.addAttribute("ordinaryUrl", response.getMsg());
|
||||
return "txt";
|
||||
} else if(type.equalsIgnoreCase("pdf")){
|
||||
model.addAttribute("pdfUrl",url);
|
||||
return "pdf";
|
||||
} else if(type.equalsIgnoreCase("compress")){
|
||||
String fileTree = null;
|
||||
// 判断文件名是否存在(redis缓存读取)
|
||||
if (!StringUtils.hasText(fileUtils.getConvertedFile(fileName))) {
|
||||
ReturnResponse<String> response = downloadUtils.downLoad(decodedUrl, suffix, fileName);
|
||||
if (0 != response.getCode()) {
|
||||
model.addAttribute("msg", response.getMsg());
|
||||
return "fileNotSupported";
|
||||
}
|
||||
String filePath = response.getContent();
|
||||
if ("zip".equalsIgnoreCase(suffix)
|
||||
|| "jar".equalsIgnoreCase(suffix)
|
||||
|| "gzip".equalsIgnoreCase(suffix)) {
|
||||
fileTree = zipReader.readZipFile(filePath);
|
||||
} else if ("rar".equalsIgnoreCase(suffix)) {
|
||||
fileTree = zipReader.unRar(filePath);
|
||||
}
|
||||
fileUtils.addConvertedFile(fileName, fileTree);
|
||||
}else {
|
||||
fileTree = fileUtils.getConvertedFile(fileName);
|
||||
}
|
||||
System.out.println("返回文件tree》》》》》》》》》》》》》》》》》》》");
|
||||
if (null != fileTree) {
|
||||
model.addAttribute("fileTree",fileTree);
|
||||
return "compress";
|
||||
}else {
|
||||
model.addAttribute("msg", "压缩文件类型不受支持,尝试在压缩的时候选择RAR4格式");
|
||||
return "fileNotSupported";
|
||||
}
|
||||
} else if ("office".equalsIgnoreCase(type)) {
|
||||
boolean isHtml = suffix.equalsIgnoreCase("xls")
|
||||
|| suffix.equalsIgnoreCase("xlsx");
|
||||
String pdfName = fileName.substring(0, fileName.lastIndexOf(".") + 1) + (isHtml ? "html" : "pdf");
|
||||
// 判断之前是否已转换过,如果转换过,直接返回,否则执行转换
|
||||
if (!fileUtils.listConvertedFiles().containsKey(pdfName)) {
|
||||
String filePath = fileDir + fileName;
|
||||
if (!new File(filePath).exists()) {
|
||||
ReturnResponse<String> response = downloadUtils.downLoad(decodedUrl, suffix, null);
|
||||
if (0 != response.getCode()) {
|
||||
model.addAttribute("msg", response.getMsg());
|
||||
return "fileNotSupported";
|
||||
}
|
||||
filePath = response.getContent();
|
||||
}
|
||||
String outFilePath = fileDir + pdfName;
|
||||
if (StringUtils.hasText(outFilePath)) {
|
||||
officeToPdf.openOfficeToPDF(filePath, outFilePath);
|
||||
File f = new File(filePath);
|
||||
if (f.exists()) {
|
||||
f.delete();
|
||||
}
|
||||
if (isHtml) {
|
||||
// 对转换后的文件进行操作(改变编码方式)
|
||||
fileUtils.doActionConvertedFile(outFilePath);
|
||||
}
|
||||
// 加入缓存
|
||||
fileUtils.addConvertedFile(pdfName, fileUtils.getRelativePath(outFilePath));
|
||||
}
|
||||
}
|
||||
model.addAttribute("pdfUrl", pdfName);
|
||||
return isHtml ? "html" : "pdf";
|
||||
}else {
|
||||
model.addAttribute("msg", "系统还不支持该格式文件的在线预览," +
|
||||
"如有需要请按下方显示的邮箱地址联系系统维护人员");
|
||||
return "fileNotSupported";
|
||||
}
|
||||
}
|
||||
|
||||
private String suffixFromUrl(String url) {
|
||||
String nonPramStr = url.substring(0, url.indexOf("?") != -1 ? url.indexOf("?"): url.length());
|
||||
String fileName = nonPramStr.substring(nonPramStr.lastIndexOf("/") + 1);
|
||||
String fileType = fileName.substring(fileName.lastIndexOf(".") + 1);
|
||||
return fileType;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查看文件类型(防止参数中存在.点号或者其他特殊字符,所以先抽取文件名,然后再获取文件类型)
|
||||
* @param url
|
||||
* @return
|
||||
*/
|
||||
private String typeFromUrl(String url) {
|
||||
String nonPramStr = url.substring(0, url.indexOf("?") != -1 ? url.indexOf("?"): url.length());
|
||||
String fileName = nonPramStr.substring(nonPramStr.lastIndexOf("/") + 1);
|
||||
String fileType = fileName.substring(fileName.lastIndexOf(".") + 1);
|
||||
if (fileUtils.listPictureTypes().contains(fileType.toLowerCase())) {
|
||||
fileType = "picture";
|
||||
}
|
||||
if (fileUtils.listArchiveTypes().contains(fileType.toLowerCase())) {
|
||||
fileType = "compress";
|
||||
}
|
||||
if (fileUtils.listOfficeTypes().contains(fileType.toLowerCase())) {
|
||||
fileType = "office";
|
||||
}
|
||||
if (Arrays.asList(simText).contains(fileType.toLowerCase())) {
|
||||
fileType = "simText";
|
||||
}
|
||||
return fileType;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据url获取文件内容
|
||||
* 当pdfjs读取存在跨域问题的文件时将通过此接口读取
|
||||
* @param urlPath
|
||||
* @param resp
|
||||
*/
|
||||
@RequestMapping(value = "/getCorsFile", method = RequestMethod.GET)
|
||||
public void getCorsFile(String urlPath, HttpServletResponse resp) {
|
||||
InputStream inputStream = null;
|
||||
try {
|
||||
String strUrl = urlPath.trim();
|
||||
URL url=new URL(strUrl);
|
||||
//打开请求连接
|
||||
URLConnection connection = url.openConnection();
|
||||
HttpURLConnection httpURLConnection=(HttpURLConnection) connection;
|
||||
httpURLConnection.setRequestProperty("User-Agent", "Mozilla/4.0 (compatible; MSIE 5.0; Windows NT; DigExt)");
|
||||
inputStream = httpURLConnection.getInputStream();
|
||||
byte[] bs = new byte[1024];
|
||||
int len;
|
||||
while(-1 != (len = inputStream.read(bs))) {
|
||||
resp.getOutputStream().write(bs, 0, len);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
if(inputStream != null) {
|
||||
IOUtils.closeQuietly(inputStream);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
0
jodconverter-web/src/main/log/.gitkeep
Normal file
0
jodconverter-web/src/main/log/.gitkeep
Normal file
54
jodconverter-web/src/main/office/help/idxcaption.xsl
Normal file
54
jodconverter-web/src/main/office/help/idxcaption.xsl
Normal file
@@ -0,0 +1,54 @@
|
||||
<!--***********************************************************
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you 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 limitations
|
||||
* under the License.
|
||||
*
|
||||
***********************************************************-->
|
||||
<xsl:stylesheet version="1.0" encoding="UTF-8"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:office="http://openoffice.org/2000/office"
|
||||
xmlns:style="http://openoffice.org/2000/style"
|
||||
xmlns:table="http://openoffice.org/2000/table"
|
||||
xmlns:draw="http://openoffice.org/2000/drawing"
|
||||
xmlns:fo="http://www.w3.org/1999/XSL/Format"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:meta="http://openoffice.org/2000/meta"
|
||||
xmlns:number="http://openoffice.org/2000/datastyle"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns:chart="http://openoffice.org/2000/chart"
|
||||
xmlns:help="http://openoffice.org/2000/help"
|
||||
xmlns:index="http://sun.com/2000/XMLSearch"
|
||||
xmlns:text="http://openoffice.org/2000/text">
|
||||
|
||||
<xsl:param name="Language" select="'en-US'"/>
|
||||
<xsl:output method="text" encoding="UTF-8"/>
|
||||
|
||||
<xsl:template match="/">
|
||||
<xsl:apply-templates select="//title" mode="include"/>
|
||||
<xsl:apply-templates select="//paragraph[@role='heading']" mode="include"/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="*" mode="include">
|
||||
<xsl:value-of select="."/>
|
||||
<xsl:text>
</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="*"/>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
||||
124
jodconverter-web/src/main/office/help/idxcontent.xsl
Normal file
124
jodconverter-web/src/main/office/help/idxcontent.xsl
Normal file
@@ -0,0 +1,124 @@
|
||||
<!--***********************************************************
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you 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 limitations
|
||||
* under the License.
|
||||
*
|
||||
***********************************************************-->
|
||||
<xsl:stylesheet version="1.0" encoding="UTF-8"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:office="http://openoffice.org/2000/office"
|
||||
xmlns:style="http://openoffice.org/2000/style"
|
||||
xmlns:table="http://openoffice.org/2000/table"
|
||||
xmlns:draw="http://openoffice.org/2000/drawing"
|
||||
xmlns:fo="http://www.w3.org/1999/XSL/Format"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:meta="http://openoffice.org/2000/meta"
|
||||
xmlns:number="http://openoffice.org/2000/datastyle"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns:chart="http://openoffice.org/2000/chart"
|
||||
xmlns:help="http://openoffice.org/2000/help"
|
||||
xmlns:index="http://sun.com/2000/XMLSearch"
|
||||
xmlns:text="http://openoffice.org/2000/text">
|
||||
|
||||
<xsl:param name="Language" select="'en-US'"/>
|
||||
<xsl:output method="text" encoding="UTF-8"/>
|
||||
|
||||
<xsl:template match="helpdocument|body">
|
||||
<xsl:choose>
|
||||
<xsl:when test="meta/topic[@indexer='exclude']"/>
|
||||
<xsl:otherwise>
|
||||
<xsl:apply-templates/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="title">
|
||||
<xsl:value-of select="."/>
|
||||
<xsl:text>
</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="table">
|
||||
<xsl:apply-templates/>
|
||||
<xsl:text>
</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="tablecell">
|
||||
<xsl:apply-templates/>
|
||||
<xsl:text>
</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="tablerow">
|
||||
<xsl:apply-templates/>
|
||||
<xsl:text>
</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="list">
|
||||
<xsl:apply-templates/>
|
||||
<xsl:text>
</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="listitem">
|
||||
<xsl:apply-templates/>
|
||||
<xsl:text>
</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="item">
|
||||
<xsl:apply-templates/>
|
||||
<xsl:text>
</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="emph">
|
||||
<xsl:apply-templates/>
|
||||
<xsl:text>
</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="paragraph">
|
||||
<xsl:value-of select="."/>
|
||||
<xsl:text>
</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="section">
|
||||
<xsl:apply-templates/>
|
||||
<xsl:text>
</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="bookmark">
|
||||
<xsl:apply-templates/>
|
||||
<xsl:text>
</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="bookmark_value">
|
||||
<xsl:apply-templates/>
|
||||
<xsl:text>
</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="link">
|
||||
<xsl:apply-templates/>
|
||||
<xsl:text>
</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="ahelp[@visibility='visible']">
|
||||
<xsl:value-of select="."/>
|
||||
<xsl:text>
</xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="*"/>
|
||||
|
||||
</xsl:stylesheet>
|
||||
|
||||
|
||||
960
jodconverter-web/src/main/office/help/main_transform.xsl
Normal file
960
jodconverter-web/src/main/office/help/main_transform.xsl
Normal file
@@ -0,0 +1,960 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
|
||||
<!--***********************************************************************
|
||||
This is the main transformation style sheet for transforming.
|
||||
Only use with OOo 2.0
|
||||
Owner: fpe@openoffice.org
|
||||
=========================================================================
|
||||
Changes Log
|
||||
May 24 2004 Created
|
||||
Aug 24 2004 Fixed for help2 CWS
|
||||
Aug 27 2004 Added css link, fixed missing embed-mode for variable
|
||||
Removed width/height for images
|
||||
Sep 03 2004 Modularized xsl, added some embedded modes
|
||||
Oct 08 2004 Fixed bug wrong mode "embedded" for links
|
||||
Added embedded modes for embed and embedvar (for cascaded embeds)
|
||||
Added <p> tags around falsely embedded pars and vars
|
||||
Dec 08 2004 #i38483#, fixed wrong handling of web links
|
||||
#i37377#, fixed missing usage of Database parameter for switching
|
||||
Jan 04 2005 #i38905#, fixed buggy branding replacement template
|
||||
Mar 17 2005 #i43972#, added language info to image URL, evaluate Language parameter
|
||||
evaluate new localize attribute in images
|
||||
May 10 2005 #i48785#, fixed wrong setting of distrib variable
|
||||
Aug 16 2005 workaround for #i53365#
|
||||
Aug 19 2005 fixed missing list processing in embedded sections
|
||||
Aug 19 2005 #i53535#, fixed wrong handling of Database parameter
|
||||
Oct 17 2006 #i70462#, disabled sorting to avoid output of error messages to console
|
||||
Jun 15 2009 #i101799#, fixed wrong handling of http URLs with anchors
|
||||
***********************************************************************//-->
|
||||
|
||||
<!--***********************************************************
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you 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 limitations
|
||||
* under the License.
|
||||
*
|
||||
***********************************************************-->
|
||||
|
||||
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
|
||||
|
||||
<xsl:output indent="yes" method="html"/>
|
||||
|
||||
<!--
|
||||
############################
|
||||
# Variables and Parameters #
|
||||
############################
|
||||
//-->
|
||||
|
||||
<!-- General Usage -->
|
||||
<xsl:variable name="am" select="'&'"/>
|
||||
<xsl:variable name="sl" select="'/'"/>
|
||||
<xsl:variable name="qt" select="'"'"/>
|
||||
|
||||
<!-- generic Icon alt text -->
|
||||
<xsl:variable name="alttext" select="'text/shared/00/icon_alt.xhp'"/>
|
||||
|
||||
<!-- For calculating pixel sizes -->
|
||||
<xsl:variable name="dpi" select="'96'"/>
|
||||
<xsl:variable name="dpcm" select="'38'"/>
|
||||
|
||||
<!-- Product brand variables used in the help files -->
|
||||
<xsl:variable name="brand1" select="'$[officename]'"/>
|
||||
<xsl:variable name="brand2" select="'$[officeversion]'"/>
|
||||
<xsl:variable name="brand3" select="'%PRODUCTNAME'"/>
|
||||
<xsl:variable name="brand4" select="'%PRODUCTVERSION'"/>
|
||||
|
||||
<!-- meta data variables from the help file -->
|
||||
<xsl:variable name="filename" select="/helpdocument/meta/topic/filename"/>
|
||||
<xsl:variable name="topic_id" select="/helpdocument/meta/topic/@id"/>
|
||||
<xsl:variable name="topic_status" select="/helpdocument/meta/topic/@status"/>
|
||||
<xsl:variable name="title" select="/helpdocument/meta/topic/title"/>
|
||||
<xsl:variable name="doclang" select="/helpdocument/meta/topic/title/@xml-lang"/>
|
||||
|
||||
<!-- Module and the corresponding switching values-->
|
||||
<xsl:param name="Database" select="'swriter'"/>
|
||||
<xsl:variable name="module" select="$Database"/>
|
||||
<xsl:variable name="appl">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$module = 'swriter'"><xsl:value-of select="'WRITER'"/></xsl:when>
|
||||
<xsl:when test="$module = 'scalc'"><xsl:value-of select="'CALC'"/></xsl:when>
|
||||
<xsl:when test="$module = 'sdraw'"><xsl:value-of select="'DRAW'"/></xsl:when>
|
||||
<xsl:when test="$module = 'simpress'"><xsl:value-of select="'IMPRESS'"/></xsl:when>
|
||||
<xsl:when test="$module = 'schart'"><xsl:value-of select="'CHART'"/></xsl:when>
|
||||
<xsl:when test="$module = 'sbasic'"><xsl:value-of select="'BASIC'"/></xsl:when>
|
||||
<xsl:when test="$module = 'smath'"><xsl:value-of select="'MATH'"/></xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
|
||||
<!-- the other parameters given by the help caller -->
|
||||
<xsl:param name="System" select="'WIN'"/>
|
||||
<xsl:param name="productname" select="'Office'"/>
|
||||
<xsl:param name="productversion" select="''"/>
|
||||
<xsl:variable name="pversion">
|
||||
<xsl:value-of select="translate($productversion,' ','')"/>
|
||||
</xsl:variable>
|
||||
<!-- this is were the images are -->
|
||||
<xsl:param name="imgrepos" select="''"/>
|
||||
<xsl:param name="Id" />
|
||||
<!-- (lame) distinction between OS and Commercial -->
|
||||
<xsl:param name="distrib">
|
||||
<xsl:choose>
|
||||
<xsl:when test="starts-with($productname,'OpenOffice')">
|
||||
<xsl:value-of select="'OpenSource'"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="'COMMERCIAL'"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:param>
|
||||
<xsl:param name="Language" select="'en-US'"/>
|
||||
<xsl:variable name="lang" select="$Language"/>
|
||||
|
||||
<xsl:param name="ExtensionId" select="''"/>
|
||||
<xsl:param name="ExtensionPath" select="''"/>
|
||||
|
||||
|
||||
<!-- parts of help and image urls -->
|
||||
<xsl:variable name="help_url_prefix" select="'vnd.sun.star.help://'"/>
|
||||
<xsl:variable name="img_url_prefix" select="concat('vnd.sun.star.zip://',$imgrepos,'/')"/>
|
||||
<xsl:variable name="urlpost" select="concat('?Language=',$lang,$am,'System=',$System,$am,'UseDB=no')"/>
|
||||
<xsl:variable name="urlpre" select="$help_url_prefix" />
|
||||
<xsl:variable name="linkprefix" select="$urlpre"/>
|
||||
<xsl:variable name="linkpostfix" select="$urlpost"/>
|
||||
|
||||
<xsl:variable name="css" select="'default.css'"/>
|
||||
|
||||
<!-- images for notes, tips and warnings -->
|
||||
<xsl:variable name="note_img" select="concat($img_url_prefix,'res/helpimg/note.png')"/>
|
||||
<xsl:variable name="tip_img" select="concat($img_url_prefix,'res/helpimg/tip.png')"/>
|
||||
<xsl:variable name="warning_img" select="concat($img_url_prefix,'res/helpimg/warning.png')"/>
|
||||
|
||||
<!--
|
||||
#############
|
||||
# Templates #
|
||||
#############
|
||||
//-->
|
||||
|
||||
<!-- Create the document skeleton -->
|
||||
<xsl:template match="/">
|
||||
<xsl:variable name="csslink" select="concat($urlpre,'/',$urlpost)"/>
|
||||
<html>
|
||||
<head>
|
||||
<title><xsl:value-of select="$title"/></title>
|
||||
<link href="{$csslink}" rel="Stylesheet" type="text/css" /> <!-- stylesheet link -->
|
||||
<meta http-equiv="Content-type" content="text/html; charset=utf-8"/>
|
||||
</head>
|
||||
<body lang="{$lang}">
|
||||
<xsl:apply-templates select="/helpdocument/body"/>
|
||||
</body>
|
||||
</html>
|
||||
</xsl:template>
|
||||
|
||||
<!-- AHELP -->
|
||||
<xsl:template match="ahelp">
|
||||
<xsl:if test="not(@visibility='hidden')"><span class="avis"><xsl:apply-templates /></span></xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<!-- ALT -->
|
||||
<xsl:template match="alt"/>
|
||||
|
||||
<!-- BOOKMARK -->
|
||||
<xsl:template match="bookmark">
|
||||
<a name="{@id}"></a>
|
||||
<xsl:choose>
|
||||
<xsl:when test="starts-with(@branch,'hid')" />
|
||||
<xsl:otherwise><xsl:apply-templates /></xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
<xsl:template match="bookmark" mode="embedded" />
|
||||
|
||||
<!-- BOOKMARK_VALUE -->
|
||||
<xsl:template match="bookmark_value" />
|
||||
|
||||
<!-- BR -->
|
||||
<xsl:template match="br"><br /></xsl:template>
|
||||
|
||||
<!-- CAPTION -->
|
||||
<xsl:template match="caption" />
|
||||
|
||||
<!-- CASE -->
|
||||
<xsl:template match="case"><xsl:call-template name="insertcase" /></xsl:template>
|
||||
<xsl:template match="case" mode="embedded">
|
||||
<xsl:call-template name="insertcase">
|
||||
<xsl:with-param name="embedded" select="'yes'"/>
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
<!-- CASEINLINE -->
|
||||
<xsl:template match="caseinline"><xsl:call-template name="insertcase" /></xsl:template>
|
||||
<xsl:template match="caseinline" mode="embedded">
|
||||
<xsl:call-template name="insertcase">
|
||||
<xsl:with-param name="embedded" select="'yes'"/>
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
<!-- COMMENT -->
|
||||
<xsl:template match="comment" />
|
||||
<xsl:template match="comment" mode="embedded"/>
|
||||
|
||||
<!-- CREATED -->
|
||||
<xsl:template match="created" />
|
||||
|
||||
<!-- DEFAULT -->
|
||||
<xsl:template match="default"><xsl:call-template name="insertdefault" /></xsl:template>
|
||||
<xsl:template match="default" mode="embedded">
|
||||
<xsl:call-template name="insertdefault">
|
||||
<xsl:with-param name="embedded" select="'yes'"/>
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
<!-- DEFAULTINLINE -->
|
||||
<xsl:template match="defaultinline"><xsl:call-template name="insertdefault" /></xsl:template>
|
||||
<xsl:template match="defaultinline" mode="embedded">
|
||||
<xsl:call-template name="insertdefault">
|
||||
<xsl:with-param name="embedded" select="'yes'"/>
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
<!-- EMBED -->
|
||||
<xsl:template match="embed"><xsl:call-template name="resolveembed"/></xsl:template>
|
||||
<xsl:template match="embed" mode="embedded"><xsl:call-template name="resolveembed"/></xsl:template>
|
||||
|
||||
<!-- EMBEDVAR -->
|
||||
<xsl:template match="embedvar"><xsl:call-template name="resolveembedvar"/></xsl:template>
|
||||
<xsl:template match="embedvar" mode="embedded"><xsl:call-template name="resolveembedvar"/></xsl:template>
|
||||
|
||||
<!-- EMPH -->
|
||||
<xsl:template match="emph">
|
||||
<span class="emph"><xsl:apply-templates /></span>
|
||||
</xsl:template>
|
||||
<xsl:template match="emph" mode="embedded">
|
||||
<span class="emph"><xsl:apply-templates /></span>
|
||||
</xsl:template>
|
||||
|
||||
<!-- FILENAME -->
|
||||
<xsl:template match="filename" />
|
||||
|
||||
<!-- HISTORY -->
|
||||
<xsl:template match="history" />
|
||||
|
||||
<!-- IMAGE -->
|
||||
<xsl:template match="image"><xsl:call-template name="insertimage"/></xsl:template>
|
||||
<xsl:template match="image" mode="embedded"><xsl:call-template name="insertimage"/></xsl:template>
|
||||
|
||||
<!-- ITEM -->
|
||||
<xsl:template match="item"><span class="{@type}"><xsl:apply-templates /></span></xsl:template>
|
||||
<xsl:template match="item" mode="embedded"><span class="{@type}"><xsl:apply-templates /></span></xsl:template>
|
||||
|
||||
<!-- LASTEDITED -->
|
||||
<xsl:template match="lastedited" />
|
||||
|
||||
<!-- LINK -->
|
||||
<xsl:template match="link">
|
||||
<xsl:choose> <!-- don't insert the heading link to itself -->
|
||||
<xsl:when test="(concat('/',@href) = /helpdocument/meta/topic/filename) or (@href = /helpdocument/meta/topic/filename)">
|
||||
<xsl:apply-templates />
|
||||
</xsl:when>
|
||||
<xsl:when test="contains(child::embedvar/@href,'/00/00000004.xhp#wie')"> <!-- special treatment of howtoget links -->
|
||||
<xsl:call-template name="insert_howtoget">
|
||||
<xsl:with-param name="linkhref" select="@href"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:call-template name="createlink" />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
<xsl:template match="link" mode="embedded">
|
||||
<xsl:call-template name="createlink"/>
|
||||
</xsl:template>
|
||||
|
||||
<!-- LIST -->
|
||||
<xsl:template match="list">
|
||||
<xsl:choose>
|
||||
<xsl:when test="@type='ordered'">
|
||||
<ol>
|
||||
<xsl:if test="@startwith">
|
||||
<xsl:attribute name="start"><xsl:value-of select="@startwith"/></xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:apply-templates />
|
||||
</ol>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<ul><xsl:apply-templates /></ul>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="list" mode="embedded">
|
||||
<xsl:choose>
|
||||
<xsl:when test="@type='ordered'">
|
||||
<ol>
|
||||
<xsl:if test="@startwith">
|
||||
<xsl:attribute name="start"><xsl:value-of select="@startwith"/></xsl:attribute>
|
||||
</xsl:if>
|
||||
<xsl:apply-templates mode="embedded"/>
|
||||
</ol>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<ul><xsl:apply-templates mode="embedded"/></ul>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<!-- LISTITEM -->
|
||||
<xsl:template match="listitem">
|
||||
<li><xsl:apply-templates /></li>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="listitem" mode="embedded">
|
||||
<li><xsl:apply-templates mode="embedded"/></li>
|
||||
</xsl:template>
|
||||
|
||||
<!-- META, SEE HEADER -->
|
||||
<xsl:template match="meta" />
|
||||
|
||||
<!-- OBJECT (UNUSED) -->
|
||||
<xsl:template match="object" />
|
||||
|
||||
<!-- PARAGRAPH -->
|
||||
<xsl:template match="paragraph">
|
||||
<xsl:choose>
|
||||
|
||||
<xsl:when test="@role='heading'">
|
||||
<xsl:call-template name="insertheading">
|
||||
<xsl:with-param name="level" select="@level"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="contains(' note warning tip ',@role)">
|
||||
<xsl:call-template name="insertnote">
|
||||
<xsl:with-param name="type" select="@role" />
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="contains(descendant::embedvar/@href,'/00/00000004.xhp#wie')"> <!-- special treatment of howtoget links -->
|
||||
<xsl:apply-templates />
|
||||
</xsl:when>
|
||||
|
||||
<xsl:otherwise>
|
||||
<xsl:call-template name="insertpara" />
|
||||
</xsl:otherwise>
|
||||
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="paragraph" mode="embedded">
|
||||
<xsl:choose>
|
||||
|
||||
<xsl:when test="@role='heading'"> <!-- increase the level of headings that are embedded -->
|
||||
<!--
|
||||
The internal sablotron processor does not seem to support the number function.
|
||||
Therefore, we need a workaround for
|
||||
<xsl:variable name="level"><xsl:value-of select="number(@level)+1"/></xsl:variable>
|
||||
-->
|
||||
<xsl:variable name="newlevel">
|
||||
<xsl:choose>
|
||||
<xsl:when test="@level='1'"><xsl:value-of select="'2'"/></xsl:when>
|
||||
<xsl:when test="@level='2'"><xsl:value-of select="'2'"/></xsl:when>
|
||||
<xsl:when test="@level='3'"><xsl:value-of select="'3'"/></xsl:when>
|
||||
<xsl:when test="@level='4'"><xsl:value-of select="'4'"/></xsl:when>
|
||||
<xsl:when test="@level='5'"><xsl:value-of select="'5'"/></xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:call-template name="insertheading">
|
||||
<xsl:with-param name="level" select="$newlevel"/>
|
||||
<xsl:with-param name="embedded" select="'yes'"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="contains(' note warning tip ',@role)">
|
||||
<xsl:call-template name="insertnote">
|
||||
<xsl:with-param name="type" select="@role" />
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="contains(descendant::embedvar/@href,'/00/00000004.xhp#wie')"> <!-- special treatment of howtoget links -->
|
||||
<xsl:apply-templates />
|
||||
</xsl:when>
|
||||
|
||||
<xsl:otherwise>
|
||||
<xsl:call-template name="insertpara" />
|
||||
</xsl:otherwise>
|
||||
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!-- SECTION -->
|
||||
<xsl:template match="section">
|
||||
<a name="{@id}"></a>
|
||||
|
||||
<xsl:choose>
|
||||
|
||||
<xsl:when test="@id='relatedtopics'">
|
||||
<div class="relatedtopics">
|
||||
<xsl:variable name="href"><xsl:value-of select="concat($urlpre,'shared/text/shared/00/00000004.xhp',$urlpost)"/></xsl:variable>
|
||||
<xsl:variable name="anchor"><xsl:value-of select="'related'"/></xsl:variable>
|
||||
<xsl:variable name="doc" select="document($href)"/>
|
||||
<p class="related">
|
||||
<xsl:apply-templates select="$doc//variable[@id=$anchor]"/>
|
||||
</p>
|
||||
<div class="relatedbody">
|
||||
<xsl:apply-templates />
|
||||
</div>
|
||||
</div>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="@id='howtoget'">
|
||||
<xsl:call-template name="insert_howtoget" />
|
||||
</xsl:when>
|
||||
|
||||
<xsl:otherwise>
|
||||
<xsl:apply-templates/>
|
||||
</xsl:otherwise>
|
||||
|
||||
</xsl:choose>
|
||||
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!-- SECTION -->
|
||||
<xsl:template match="section" mode="embedded">
|
||||
<a name="{@id}"></a>
|
||||
<xsl:apply-templates mode="embedded"/>
|
||||
</xsl:template>
|
||||
|
||||
<!-- SORT -->
|
||||
<xsl:template match="sort" >
|
||||
<xsl:apply-templates><xsl:sort select="descendant::paragraph"/></xsl:apply-templates>
|
||||
</xsl:template>
|
||||
<xsl:template match="sort" mode="embedded">
|
||||
<xsl:apply-templates><xsl:sort select="descendant::paragraph"/></xsl:apply-templates>
|
||||
</xsl:template>
|
||||
|
||||
<!-- SWITCH -->
|
||||
<xsl:template match="switch"><xsl:apply-templates /></xsl:template>
|
||||
<xsl:template match="switch" mode="embedded"><xsl:apply-templates /></xsl:template>
|
||||
|
||||
<!-- SWITCHINLINE -->
|
||||
<xsl:template match="switchinline"><xsl:apply-templates /></xsl:template>
|
||||
<xsl:template match="switchinline" mode="embedded"><xsl:apply-templates mode="embedded"/></xsl:template>
|
||||
|
||||
<!-- TABLE -->
|
||||
<xsl:template match="table"><xsl:call-template name="inserttable"/></xsl:template>
|
||||
<xsl:template match="table" mode="embedded"><xsl:call-template name="inserttable"/></xsl:template>
|
||||
|
||||
<!-- TABLECELL -->
|
||||
<xsl:template match="tablecell"><td valign="top"><xsl:apply-templates /></td></xsl:template>
|
||||
<xsl:template match="tablecell" mode="icontable"><td valign="top"><xsl:apply-templates/></td></xsl:template>
|
||||
<xsl:template match="tablecell" mode="embedded"><td valign="top"><xsl:apply-templates mode="embedded"/></td></xsl:template>
|
||||
|
||||
<!-- TABLEROW -->
|
||||
<xsl:template match="tablerow"><tr><xsl:apply-templates /></tr></xsl:template>
|
||||
<xsl:template match="tablerow" mode="icontable"><tr><xsl:apply-templates mode="icontable"/></tr></xsl:template>
|
||||
<xsl:template match="tablerow" mode="embedded"><tr><xsl:apply-templates mode="embedded"/></tr></xsl:template>
|
||||
|
||||
<!-- TITLE -->
|
||||
<xsl:template match="title"/>
|
||||
|
||||
<!-- TOPIC -->
|
||||
<xsl:template match="topic"/>
|
||||
|
||||
<!-- VARIABLE -->
|
||||
<xsl:template match="variable"><a name="{@id}"></a><xsl:apply-templates /></xsl:template>
|
||||
<xsl:template match="variable" mode="embedded"><a name="{@id}"></a><xsl:apply-templates mode="embedded"/></xsl:template>
|
||||
|
||||
<xsl:template match="text()">
|
||||
<xsl:call-template name="brand">
|
||||
<xsl:with-param name="string"><xsl:value-of select="."/></xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template match="text()" mode="embedded">
|
||||
<xsl:call-template name="brand">
|
||||
<xsl:with-param name="string"><xsl:value-of select="."/></xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</xsl:template>
|
||||
|
||||
<!-- In case of missing help files -->
|
||||
<xsl:template match="help-id-missing"><xsl:value-of select="$Id"/></xsl:template>
|
||||
|
||||
<!--
|
||||
###################
|
||||
# NAMED TEMPLATES #
|
||||
###################
|
||||
//-->
|
||||
|
||||
<!-- Branding -->
|
||||
<xsl:template name="brand" >
|
||||
<xsl:param name="string"/>
|
||||
|
||||
<xsl:choose>
|
||||
|
||||
<xsl:when test="contains($string,$brand1)">
|
||||
<xsl:variable name="newstr">
|
||||
<xsl:value-of select="substring-before($string,$brand1)"/>
|
||||
<xsl:value-of select="$productname"/>
|
||||
<xsl:value-of select="substring-after($string,$brand1)"/>
|
||||
</xsl:variable>
|
||||
<xsl:call-template name="brand">
|
||||
<xsl:with-param name="string" select="$newstr"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="contains($string,$brand2)">
|
||||
<xsl:variable name="newstr">
|
||||
<xsl:value-of select="substring-before($string,$brand2)"/>
|
||||
<xsl:value-of select="$pversion"/>
|
||||
<xsl:value-of select="substring-after($string,$brand2)"/>
|
||||
</xsl:variable>
|
||||
<xsl:call-template name="brand">
|
||||
<xsl:with-param name="string" select="$newstr"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="contains($string,$brand3)">
|
||||
<xsl:variable name="newstr">
|
||||
<xsl:value-of select="substring-before($string,$brand3)"/>
|
||||
<xsl:value-of select="$productname"/>
|
||||
<xsl:value-of select="substring-after($string,$brand3)"/>
|
||||
</xsl:variable>
|
||||
<xsl:call-template name="brand">
|
||||
<xsl:with-param name="string" select="$newstr"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="contains($string,$brand4)">
|
||||
<xsl:variable name="newstr">
|
||||
<xsl:value-of select="substring-before($string,$brand4)"/>
|
||||
<xsl:value-of select="$pversion"/>
|
||||
<xsl:value-of select="substring-after($string,$brand4)"/>
|
||||
</xsl:variable>
|
||||
<xsl:call-template name="brand">
|
||||
<xsl:with-param name="string" select="$newstr"/>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$string"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
|
||||
</xsl:template>
|
||||
|
||||
|
||||
<!-- Insert Paragraph -->
|
||||
<xsl:template name="insertpara">
|
||||
<xsl:variable name="role">
|
||||
<xsl:choose>
|
||||
<xsl:when test="ancestor::table">
|
||||
<xsl:value-of select="concat(@role,'intable')"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="@role"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<p class="{$role}"><xsl:apply-templates /></p>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Insert "How to get Link" -->
|
||||
<xsl:template name="insert_howtoget">
|
||||
<xsl:param name="linkhref" />
|
||||
<xsl:variable name="archive" select="'shared'"/>
|
||||
<xsl:variable name="tmp_href"><xsl:value-of select="concat($urlpre,'shared/text/shared/00/00000004.xhp',$urlpost)"/></xsl:variable>
|
||||
<xsl:variable name="tmp_doc" select="document($tmp_href)"/>
|
||||
<table class="howtoget" width="100%" border="1" cellpadding="3" cellspacing="0">
|
||||
<tr>
|
||||
<td>
|
||||
<p class="howtogetheader"><xsl:apply-templates select="$tmp_doc//variable[@id='wie']"/></p>
|
||||
<div class="howtogetbody">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$linkhref = ''"> <!-- new style -->
|
||||
<xsl:apply-templates/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise> <!-- old style -->
|
||||
<xsl:variable name="archive1"><xsl:value-of select="concat(substring-before(substring-after($linkhref,'text/'),'/'),'/')"/></xsl:variable>
|
||||
<xsl:variable name="href"><xsl:value-of select="concat($urlpre,$archive1,substring-before($linkhref,'#'),$urlpost)"/></xsl:variable>
|
||||
<xsl:variable name="anc"><xsl:value-of select="substring-after($linkhref,'#')"/></xsl:variable>
|
||||
<xsl:variable name="docum" select="document($href)"/>
|
||||
|
||||
<xsl:call-template name="insertembed">
|
||||
<xsl:with-param name="doc" select="$docum" />
|
||||
<xsl:with-param name="anchor" select="$anc" />
|
||||
</xsl:call-template>
|
||||
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br/>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Create a link -->
|
||||
<xsl:template name="createlink">
|
||||
<xsl:variable name="archive"><xsl:value-of select="concat(substring-before(substring-after(@href,'text/'),'/'),'/')"/></xsl:variable>
|
||||
<xsl:variable name="dbpostfix"><xsl:call-template name="createDBpostfix"><xsl:with-param name="archive" select="$archive"/></xsl:call-template></xsl:variable>
|
||||
<xsl:choose>
|
||||
<xsl:when test="starts-with(@href,'http://') or starts-with(@href,'https://')"> <!-- web links -->
|
||||
<a href="{@href}"><xsl:apply-templates /></a>
|
||||
</xsl:when>
|
||||
<xsl:when test="contains(@href,'#')">
|
||||
<xsl:variable name="anchor"><xsl:value-of select="concat('#',substring-after(@href,'#'))"/></xsl:variable>
|
||||
<xsl:variable name="href"><xsl:value-of select="concat($linkprefix,$archive,substring-before(@href,'#'),$linkpostfix,$dbpostfix,$anchor)"/></xsl:variable>
|
||||
<a href="{$href}"><xsl:apply-templates /></a>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:variable name="href"><xsl:value-of select="concat($linkprefix,$archive,@href,$linkpostfix,$dbpostfix)"/></xsl:variable>
|
||||
<a href="{$href}"><xsl:apply-templates /></a>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Insert Note, Warning, or Tip -->
|
||||
<xsl:template name="insertnote">
|
||||
<xsl:param name="type" /> <!-- note, tip, or warning -->
|
||||
<xsl:variable name="imgsrc">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$type='note'"><xsl:value-of select="$note_img"/></xsl:when>
|
||||
<xsl:when test="$type='tip'"><xsl:value-of select="$tip_img"/></xsl:when>
|
||||
<xsl:when test="$type='warning'"><xsl:value-of select="$warning_img"/></xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<xsl:variable name="dbpostfix"><xsl:call-template name="createDBpostfix"><xsl:with-param name="archive" select="'shared'"/></xsl:call-template></xsl:variable>
|
||||
<xsl:variable name="alt">
|
||||
<xsl:variable name="href"><xsl:value-of select="concat($urlpre,'shared/',$alttext,$urlpost,$dbpostfix)"/></xsl:variable>
|
||||
<xsl:variable name="anchor"><xsl:value-of select="concat('alt_',$type)"/></xsl:variable>
|
||||
<xsl:variable name="doc" select="document($href)"/>
|
||||
<xsl:apply-templates select="$doc//variable[@id=$anchor]" mode="embedded"/>
|
||||
</xsl:variable>
|
||||
<div class="{$type}">
|
||||
<table border="0" class="{$type}" cellspacing="0" cellpadding="5">
|
||||
<tr>
|
||||
<td><img src="{$imgsrc}" alt="{$alt}" title="{$alt}"/></td>
|
||||
<td><xsl:apply-templates /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
<br/>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Insert a heading -->
|
||||
<xsl:template name="insertheading">
|
||||
<xsl:param name="level" />
|
||||
<xsl:param name="embedded" />
|
||||
<xsl:text disable-output-escaping="yes"><h</xsl:text><xsl:value-of select="$level"/><xsl:text disable-output-escaping="yes">></xsl:text>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$embedded = 'yes'">
|
||||
<xsl:apply-templates mode="embedded"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:apply-templates />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
<xsl:text disable-output-escaping="yes"></h</xsl:text><xsl:value-of select="$level"/><xsl:text disable-output-escaping="yes">></xsl:text>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Evaluate a case or caseinline switch -->
|
||||
<xsl:template name="insertcase">
|
||||
<xsl:param name="embedded" />
|
||||
<xsl:choose>
|
||||
<xsl:when test="parent::switch[@select='sys'] or parent::switchinline[@select='sys']">
|
||||
<xsl:if test="@select = $System">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$embedded = 'yes'">
|
||||
<xsl:apply-templates mode="embedded"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:apply-templates />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:if>
|
||||
</xsl:when>
|
||||
<xsl:when test="parent::switch[@select='appl'] or parent::switchinline[@select='appl']">
|
||||
<xsl:if test="@select = $appl">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$embedded = 'yes'">
|
||||
<xsl:apply-templates mode="embedded"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:apply-templates />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:if>
|
||||
</xsl:when>
|
||||
<xsl:when test="parent::switch[@select='distrib'] or parent::switchinline[@select='distrib']">
|
||||
<xsl:if test="@select = $distrib">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$embedded = 'yes'">
|
||||
<xsl:apply-templates mode="embedded"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:apply-templates />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:if>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Evaluate a default or defaultinline switch -->
|
||||
<xsl:template name="insertdefault">
|
||||
<xsl:param name="embedded" />
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="parent::switch[@select='sys'] or parent::switchinline[@select='sys']">
|
||||
<xsl:if test="not(../child::case[@select=$System]) and not(../child::caseinline[@select=$System])">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$embedded = 'yes'">
|
||||
<xsl:apply-templates mode="embedded"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:apply-templates />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:if>
|
||||
</xsl:when>
|
||||
<xsl:when test="parent::switch[@select='appl'] or parent::switchinline[@select='appl']">
|
||||
<xsl:if test="not(../child::case[@select=$appl]) and not(../child::caseinline[@select=$appl])">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$embedded = 'yes'">
|
||||
<xsl:apply-templates mode="embedded"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:apply-templates />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:if>
|
||||
</xsl:when>
|
||||
<xsl:when test="parent::switch[@select='distrib'] or parent::switchinline[@select='distrib']">
|
||||
<xsl:if test="not(../child::case[@select=$distrib]) and not(../child::caseinline[@select=$distrib])">
|
||||
<xsl:choose>
|
||||
<xsl:when test="$embedded = 'yes'">
|
||||
<xsl:apply-templates mode="embedded"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:apply-templates />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:if>
|
||||
</xsl:when>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<!-- evaluate embeds -->
|
||||
<xsl:template name="insertembed">
|
||||
<xsl:param name="doc" />
|
||||
<xsl:param name="anchor" />
|
||||
<!-- different embed targets (also falsely used embed instead embedvar) -->
|
||||
<xsl:choose>
|
||||
<xsl:when test="$doc//section[@id=$anchor]"> <!-- first test for a section of that name -->
|
||||
<xsl:apply-templates select="$doc//section[@id=$anchor]" mode="embedded"/>
|
||||
</xsl:when>
|
||||
<xsl:when test="$doc//paragraph[@id=$anchor]"> <!-- then test for a para of that name -->
|
||||
<p class="embedded">
|
||||
<xsl:apply-templates select="$doc//paragraph[@id=$anchor]" mode="embedded"/>
|
||||
</p>
|
||||
</xsl:when>
|
||||
<xsl:when test="$doc//variable[@id=$anchor]"> <!-- then test for a variable of that name -->
|
||||
<p class="embedded">
|
||||
<xsl:apply-templates select="$doc//variable[@id=$anchor]" mode="embedded"/>
|
||||
</p>
|
||||
</xsl:when>
|
||||
<xsl:otherwise> <!-- then give up -->
|
||||
<p class="bug">D'oh! You found a bug (<xsl:value-of select="@href"/> not found).</p>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Insert an image -->
|
||||
<xsl:template name="insertimage">
|
||||
|
||||
<xsl:variable name="fpath">
|
||||
<xsl:call-template name="getfpath">
|
||||
<xsl:with-param name="s"><xsl:value-of select="@src"/></xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="fname">
|
||||
<xsl:call-template name="getfname">
|
||||
<xsl:with-param name="s"><xsl:value-of select="@src"/></xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:variable name="src">
|
||||
<xsl:choose>
|
||||
<xsl:when test="not($ExtensionId='') and starts-with(@src,$ExtensionId)">
|
||||
<xsl:value-of select="concat($ExtensionPath,'/',@src)"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:choose>
|
||||
<xsl:when test="(@localize='true') and not($lang='en-US')">
|
||||
<xsl:value-of select="concat($img_url_prefix,$fpath,$lang,'/',$fname)"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="concat($img_url_prefix,$fpath,$fname)"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
|
||||
<!--<xsl:variable name="src"><xsl:value-of select="concat($img_url_prefix,@src)"/></xsl:variable>-->
|
||||
<xsl:variable name="alt"><xsl:value-of select="./alt"/></xsl:variable>
|
||||
<xsl:variable name="width" select="''"/> <!-- Images don't all have the correct size -->
|
||||
<xsl:variable name="height" select="''"/><!-- Image don't all have the correct size -->
|
||||
<img src="{$src}" alt="{$alt}" title="{$alt}">
|
||||
<xsl:if test="not($width='')"><xsl:attribute name="width"><xsl:value-of select="$width"/></xsl:attribute></xsl:if>
|
||||
<xsl:if test="not($height='')"><xsl:attribute name="height"><xsl:value-of select="$height"/></xsl:attribute></xsl:if>
|
||||
</img>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Insert a Table -->
|
||||
<xsl:template name="inserttable">
|
||||
<xsl:variable name="imgsrc"> <!-- see if we are in an image table -->
|
||||
<xsl:value-of select="tablerow/tablecell[1]/paragraph[1]/image/@src"/>
|
||||
</xsl:variable>
|
||||
|
||||
<xsl:choose>
|
||||
|
||||
<xsl:when test="count(descendant::tablecell)=1">
|
||||
<table border="0" class="onecell" cellpadding="0" cellspacing="0">
|
||||
<xsl:apply-templates />
|
||||
</table>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="descendant::tablecell[1]/descendant::image">
|
||||
<table border="0" class="icontable" cellpadding="5" cellspacing="0">
|
||||
<xsl:apply-templates mode="icontable"/>
|
||||
</table>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="@class='wide'">
|
||||
<table border="1" class="{@class}" cellpadding="0" cellspacing="0" width="100%" >
|
||||
<xsl:apply-templates />
|
||||
</table>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:when test="not(@class='')">
|
||||
<table border="1" class="{@class}" cellpadding="0" cellspacing="0" >
|
||||
<xsl:apply-templates />
|
||||
</table>
|
||||
</xsl:when>
|
||||
|
||||
<xsl:otherwise>
|
||||
<table border="1" class="border" cellpadding="0" cellspacing="0" >
|
||||
<xsl:apply-templates />
|
||||
</table>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
|
||||
<br/>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="resolveembed">
|
||||
<div class="embedded">
|
||||
<xsl:variable name="archive"><xsl:value-of select="concat(substring-before(substring-after(@href,'text/'),'/'),'/')"/></xsl:variable>
|
||||
<xsl:variable name="dbpostfix"><xsl:call-template name="createDBpostfix"><xsl:with-param name="archive" select="$archive"/></xsl:call-template></xsl:variable>
|
||||
<xsl:variable name="href"><xsl:value-of select="concat($urlpre,$archive,substring-before(@href,'#'),$urlpost,$dbpostfix)"/></xsl:variable>
|
||||
<xsl:variable name="anc"><xsl:value-of select="substring-after(@href,'#')"/></xsl:variable>
|
||||
<xsl:variable name="docum" select="document($href)"/>
|
||||
|
||||
<xsl:call-template name="insertembed">
|
||||
<xsl:with-param name="doc" select="$docum" />
|
||||
<xsl:with-param name="anchor" select="$anc" />
|
||||
</xsl:call-template>
|
||||
|
||||
</div>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="resolveembedvar">
|
||||
<xsl:if test="not(@href='text/shared/00/00000004.xhp#wie')"> <!-- special treatment if howtoget links -->
|
||||
<xsl:variable name="archive"><xsl:value-of select="concat(substring-before(substring-after(@href,'text/'),'/'),'/')"/></xsl:variable>
|
||||
<xsl:variable name="dbpostfix"><xsl:call-template name="createDBpostfix"><xsl:with-param name="archive" select="$archive"/></xsl:call-template></xsl:variable>
|
||||
<xsl:variable name="href"><xsl:value-of select="concat($urlpre,$archive,substring-before(@href,'#'),$urlpost,$dbpostfix)"/></xsl:variable>
|
||||
<xsl:variable name="anchor"><xsl:value-of select="substring-after(@href,'#')"/></xsl:variable>
|
||||
<xsl:variable name="doc" select="document($href)"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="$doc//variable[@id=$anchor]"> <!-- test for a variable of that name -->
|
||||
<xsl:apply-templates select="$doc//variable[@id=$anchor]" mode="embedded"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise> <!-- or give up -->
|
||||
<span class="bug">[<xsl:value-of select="@href"/> not found].</span>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:if>
|
||||
</xsl:template>
|
||||
|
||||
<!-- Apply -->
|
||||
<xsl:template name="apply">
|
||||
<xsl:param name="embedded" />
|
||||
<xsl:choose>
|
||||
<xsl:when test="$embedded = 'yes'">
|
||||
<xsl:apply-templates mode="embedded"/>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:apply-templates />
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="getfpath">
|
||||
<xsl:param name="s"/>
|
||||
<xsl:param name="p"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains($s,'/')">
|
||||
<xsl:call-template name="getfpath">
|
||||
<xsl:with-param name="p"><xsl:value-of select="concat($p,substring-before($s,'/'),'/')"/></xsl:with-param>
|
||||
<xsl:with-param name="s"><xsl:value-of select="substring-after($s,'/')"/></xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$p"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="getfname">
|
||||
<xsl:param name="s"/>
|
||||
<xsl:choose>
|
||||
<xsl:when test="contains($s,'/')">
|
||||
<xsl:call-template name="getfname">
|
||||
<xsl:with-param name="s"><xsl:value-of select="substring-after($s,'/')"/></xsl:with-param>
|
||||
</xsl:call-template>
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
<xsl:value-of select="$s"/>
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="createDBpostfix">
|
||||
<xsl:param name="archive"/>
|
||||
<xsl:variable name="newDB">
|
||||
<xsl:choose>
|
||||
<xsl:when test="(substring($archive,1,6) = 'shared')"><xsl:value-of select="$Database"/></xsl:when>
|
||||
<xsl:otherwise><xsl:value-of select="substring-before($archive,'/')"/></xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</xsl:variable>
|
||||
<xsl:value-of select="concat($am,'DbPAR=',$newDB)"/>
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
||||
94
jodconverter-web/src/main/office/help/zh-CN/default.css
Normal file
94
jodconverter-web/src/main/office/help/zh-CN/default.css
Normal file
@@ -0,0 +1,94 @@
|
||||
/**************************************************************
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you 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 limitations
|
||||
* under the License.
|
||||
*
|
||||
*************************************************************/
|
||||
|
||||
/*
|
||||
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
+ OPENOFFICE.ORG 2.0 HELP +
|
||||
+ DEFAULT STYLESHEET +
|
||||
+ CHINESE SIMPL +
|
||||
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
+ LAST CHANGES: 24-MAR-2005 +
|
||||
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
*/
|
||||
|
||||
|
||||
body, p, h1, h2, h3, h4, h5, h6, .listitem, .listitemintable, .tablecontent, .tablecontentintable
|
||||
{ font-family: 方正宋体,"MSung Light SC",SimSun,FZSongYi,FZShuSong,NSimSun,"Andale Sans UI","Arial Unicode MS","Lucida Sans Unicode",Song; }
|
||||
|
||||
.code, .codeintable, .example, .exampleintable, .literal, .literalintable, .path, .pathintable
|
||||
{ font-family: 方正宋体,"MSung Light SC",Cumberland,Courier New,Courier,"Lucida Sans Typewriter","Lucida Typewriter",Monaco,Monospaced; margin-top: 1pt; margin-bottom: 1pt;}
|
||||
|
||||
.acronym
|
||||
{ font-weight: bold; }
|
||||
|
||||
.related
|
||||
{ font-weight: bold; margin-top:20pt; border-top: 1px solid black;}
|
||||
|
||||
.emph, .menuitem, .keycode
|
||||
{ font-weight: bold; }
|
||||
|
||||
.tablehead, .tableheadintable
|
||||
{ font-weight: bold; margin-top: 0px;}
|
||||
|
||||
.howtogetheader
|
||||
{ font-weight: bold; border: 1px solid #999999; background: #FFFFFF; padding: 3px;}
|
||||
|
||||
h1, h2, h3, h4, h5, h6
|
||||
{ margin-bottom: 5pt; }
|
||||
|
||||
p, td
|
||||
{ font-size: 10pt; }
|
||||
|
||||
h1
|
||||
{ font-size: 18pt; border-bottom: 1px solid black; padding-bottom: 6px; margin-bottom: 6px;}
|
||||
|
||||
h2
|
||||
{ font-size: 14pt; }
|
||||
|
||||
h3
|
||||
{ font-size: 12pt; }
|
||||
|
||||
h4, h5, h6
|
||||
{ font-size: 10pt; }
|
||||
|
||||
.relatedtopics
|
||||
{ font-weight: normal; }
|
||||
|
||||
.relatedbody
|
||||
{ margin-top: 2px; margin-bottom: 2px; margin-left: 5px; }
|
||||
|
||||
.howtoget
|
||||
{ background:#EEEEEE;}
|
||||
|
||||
.howtogetbody
|
||||
{ background:#EEEEEE;}
|
||||
|
||||
.wide
|
||||
{ width: 100%; }
|
||||
|
||||
.topalign
|
||||
{ vertical-align: top; border: 1px;}
|
||||
|
||||
.bug
|
||||
{ color: red; border: 1px solid red;}
|
||||
|
||||
.debug
|
||||
{ border: 1px solid black; padding: 3px; display: none;}
|
||||
46
jodconverter-web/src/main/office/help/zh-CN/err.html
Normal file
46
jodconverter-web/src/main/office/help/zh-CN/err.html
Normal file
@@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
|
||||
<!--***********************************************************
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you 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 limitations
|
||||
* under the License.
|
||||
*
|
||||
***********************************************************-->
|
||||
|
||||
|
||||
|
||||
<helpdocument version="1.0">
|
||||
<meta>
|
||||
<topic id="textshared05err_htmlxml" indexer="exclude" status="PUBLISH">
|
||||
<title id="tit" xml-lang="zh-CN">未找到帮助页面</title>
|
||||
<filename>/text/shared/05/err_html.xhp</filename>
|
||||
</topic>
|
||||
<history>
|
||||
<created date="2003-10-31T00:00:00">Sun Microsystems, Inc.</created>
|
||||
<lastedited date="2005-01-11T11:07:13">converted from old format - fpe
|
||||
FPE: Updated</lastedited>
|
||||
</history>
|
||||
</meta>
|
||||
<body>
|
||||
<paragraph role="heading" id="hd_id3146957" xml-lang="zh-CN" level="1" l10n="U" oldref="1">帮助页面未能找到。</paragraph>
|
||||
<paragraph role="paragraph" id="par_id3147088" xml-lang="zh-CN" l10n="U" oldref="2">很遗憾,您所选择的帮助页面未能找到。以下数据可能对界定错误有所帮助:</paragraph>
|
||||
<paragraph role="paragraph" id="par_id3143268" xml-lang="zh-CN" l10n="U" oldref="3">帮助 ID:<emph><help-id-missing/></emph></paragraph>
|
||||
<paragraph role="paragraph" id="par_idN10681" xml-lang="zh-CN" l10n="NEW">可以使用安装应用程序来安装缺少的帮助模块。</paragraph>
|
||||
<paragraph role="paragraph" id="par_id3150541" xml-lang="zh-CN" l10n="U" oldref="16">单击<image id="img_id3148946" src="res/sc06301.png" width="0.222inch" height="0.222inch"><alt id="alt_id3148946">图标</alt></image><emph>上一步</emph>可返回上一页面。</paragraph>
|
||||
</body>
|
||||
</helpdocument>
|
||||
114
jodconverter-web/src/main/office/help/zh-CN/highcontrast1.css
Normal file
114
jodconverter-web/src/main/office/help/zh-CN/highcontrast1.css
Normal file
@@ -0,0 +1,114 @@
|
||||
/**************************************************************
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you 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 limitations
|
||||
* under the License.
|
||||
*
|
||||
*************************************************************/
|
||||
|
||||
/*
|
||||
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
+ OPENOFFICE.ORG 2.0 HELP +
|
||||
+ HIGH CONTRAST #1 STYLESHEET +
|
||||
+ CHINESE SIMPL +
|
||||
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
+ LAST CHANGES: 24-MAR-2005 +
|
||||
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
*/
|
||||
|
||||
|
||||
body, p, h1, h2, h3, h4, h5, h6, .listitem, .listitemintable, .tablecontent, .tablecontentintable
|
||||
{ font-family: 方正宋体,"MSung Light SC",SimSun,FZSongYi,FZShuSong,NSimSun,"Andale Sans UI","Arial Unicode MS","Lucida Sans Unicode",Song; }
|
||||
|
||||
.code, .codeintable, .example, .exampleintable, .literal, .literalintable, .path, .pathintable
|
||||
{ font-family: 方正宋体,"MSung Light SC",Cumberland,Courier New,Courier,"Lucida Sans Typewriter","Lucida Typewriter",Monaco,Monospaced; margin-top: 1pt; margin-bottom: 1pt;}
|
||||
|
||||
.acronym
|
||||
{ font-weight: bold; }
|
||||
|
||||
.related
|
||||
{ font-weight: bold; margin-top:20pt; border-top: 1px solid black;}
|
||||
|
||||
.emph, .menuitem, .keycode
|
||||
{ font-weight: bold; }
|
||||
|
||||
.tablehead, .tableheadintable
|
||||
{ font-weight: bold; margin-top: 0px;}
|
||||
|
||||
.howtogetheader
|
||||
{ font-weight: bold; padding: 3px;}
|
||||
|
||||
h1, h2, h3, h4, h5, h6
|
||||
{ margin-bottom: 5pt; }
|
||||
|
||||
p, td
|
||||
{ font-size: 10pt; }
|
||||
|
||||
h1
|
||||
{ font-size: 18pt; border-bottom: 1px solid black; padding-bottom: 6px; margin-bottom: 6px;}
|
||||
|
||||
h2
|
||||
{ font-size: 14pt; }
|
||||
|
||||
h3
|
||||
{ font-size: 12pt; }
|
||||
|
||||
h4, h5, h6
|
||||
{ font-size: 10pt; }
|
||||
|
||||
.relatedtopics
|
||||
{ font-weight: normal; }
|
||||
|
||||
.relatedbody
|
||||
{ margin-top: 2px; margin-bottom: 2px; margin-left: 5px; }
|
||||
|
||||
.wide
|
||||
{ width: 100%; }
|
||||
|
||||
.topalign
|
||||
{ vertical-align: top; border: 1px;}
|
||||
|
||||
.bug
|
||||
{ color: red; border: 1px solid red;}
|
||||
|
||||
.debug
|
||||
{ border: 1px solid black; padding: 3px; display: none;}
|
||||
|
||||
/* HIGH CONTRAST SPECIFIC SETTINGS */
|
||||
|
||||
body, p, h1, h2, h3, h4, h5, h6, .listitem, .listitemintable, .tablecontent, .tablecontentintable
|
||||
{ background: #000000; color: #FFFF00;}
|
||||
|
||||
.related
|
||||
{ border-top: 1px solid #FFFF00; }
|
||||
|
||||
.howtogetheader
|
||||
{border: 1px solid #EFEFEF; background: #000000;}
|
||||
|
||||
h1
|
||||
{ border-bottom: 1px solid #FFFF00; ]
|
||||
|
||||
.howtoget
|
||||
{ background:#000000;}
|
||||
|
||||
.howtogetbody
|
||||
{ background:#000000;}
|
||||
|
||||
.debug
|
||||
{ border: 1px solid red; padding: 3px; display: none;}
|
||||
|
||||
a
|
||||
{ color: #FFFF00; }
|
||||
114
jodconverter-web/src/main/office/help/zh-CN/highcontrast2.css
Normal file
114
jodconverter-web/src/main/office/help/zh-CN/highcontrast2.css
Normal file
@@ -0,0 +1,114 @@
|
||||
/**************************************************************
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you 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 limitations
|
||||
* under the License.
|
||||
*
|
||||
*************************************************************/
|
||||
|
||||
/*
|
||||
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
+ OPENOFFICE.ORG 2.0 HELP +
|
||||
+ HIGH CONTRAST #2 STYLESHEET +
|
||||
+ CHINESE SIMPL +
|
||||
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
+ LAST CHANGES: 24-MAR-2005 +
|
||||
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
*/
|
||||
|
||||
|
||||
body, p, h1, h2, h3, h4, h5, h6, .listitem, .listitemintable, .tablecontent, .tablecontentintable
|
||||
{ font-family: 方正宋体,"MSung Light SC",SimSun,FZSongYi,FZShuSong,NSimSun,"Andale Sans UI","Arial Unicode MS","Lucida Sans Unicode",Song; }
|
||||
|
||||
.code, .codeintable, .example, .exampleintable, .literal, .literalintable, .path, .pathintable
|
||||
{ font-family: 方正宋体,"MSung Light SC",Cumberland,Courier New,Courier,"Lucida Sans Typewriter","Lucida Typewriter",Monaco,Monospaced; margin-top: 1pt; margin-bottom: 1pt;}
|
||||
|
||||
.acronym
|
||||
{ font-weight: bold; }
|
||||
|
||||
.related
|
||||
{ font-weight: bold; margin-top:20pt; border-top: 1px solid black;}
|
||||
|
||||
.emph, .menuitem, .keycode
|
||||
{ font-weight: bold; }
|
||||
|
||||
.tablehead, .tableheadintable
|
||||
{ font-weight: bold; margin-top: 0px;}
|
||||
|
||||
.howtogetheader
|
||||
{ font-weight: bold; padding: 3px;}
|
||||
|
||||
h1, h2, h3, h4, h5, h6
|
||||
{ margin-bottom: 5pt; }
|
||||
|
||||
p, td
|
||||
{ font-size: 10pt; }
|
||||
|
||||
h1
|
||||
{ font-size: 18pt; border-bottom: 1px solid black; padding-bottom: 6px; margin-bottom: 6px;}
|
||||
|
||||
h2
|
||||
{ font-size: 14pt; }
|
||||
|
||||
h3
|
||||
{ font-size: 12pt; }
|
||||
|
||||
h4, h5, h6
|
||||
{ font-size: 10pt; }
|
||||
|
||||
.relatedtopics
|
||||
{ font-weight: normal; }
|
||||
|
||||
.relatedbody
|
||||
{ margin-top: 2px; margin-bottom: 2px; margin-left: 5px; }
|
||||
|
||||
.wide
|
||||
{ width: 100%; }
|
||||
|
||||
.topalign
|
||||
{ vertical-align: top; border: 1px;}
|
||||
|
||||
.bug
|
||||
{ color: red; border: 1px solid red;}
|
||||
|
||||
.debug
|
||||
{ border: 1px solid black; padding: 3px; display: none;}
|
||||
|
||||
/* HIGH CONTRAST SPECIFIC SETTINGS */
|
||||
|
||||
body, p, h1, h2, h3, h4, h5, h6, .listitem, .listitemintable, .tablecontent, .tablecontentintable
|
||||
{ background: #000000; color: #00FF00;}
|
||||
|
||||
.related
|
||||
{ border-top: 1px solid #00FF00; }
|
||||
|
||||
.howtogetheader
|
||||
{border: 1px solid #EFEFEF; background: #000000;}
|
||||
|
||||
h1
|
||||
{ border-bottom: 1px solid #00FF00; ]
|
||||
|
||||
.howtoget
|
||||
{ background:#000000;}
|
||||
|
||||
.howtogetbody
|
||||
{ background:#000000;}
|
||||
|
||||
.debug
|
||||
{ border: 1px solid red; padding: 3px; display: none;}
|
||||
|
||||
a
|
||||
{ color: #00FF00; }
|
||||
@@ -0,0 +1,114 @@
|
||||
/**************************************************************
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you 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 limitations
|
||||
* under the License.
|
||||
*
|
||||
*************************************************************/
|
||||
|
||||
/*
|
||||
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
+ OPENOFFICE.ORG 2.0 HELP +
|
||||
+ HIGH CONTRAST BLACK STYLESHEET +
|
||||
+ CHINESE SIMPL +
|
||||
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
+ LAST CHANGES: 24-MAR-2005 +
|
||||
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
*/
|
||||
|
||||
|
||||
body, p, h1, h2, h3, h4, h5, h6, .listitem, .listitemintable, .tablecontent, .tablecontentintable
|
||||
{ font-family: 方正宋体,"MSung Light SC",SimSun,FZSongYi,FZShuSong,NSimSun,"Andale Sans UI","Arial Unicode MS","Lucida Sans Unicode",Song; }
|
||||
|
||||
.code, .codeintable, .example, .exampleintable, .literal, .literalintable, .path, .pathintable
|
||||
{ font-family: 方正宋体,"MSung Light SC",Cumberland,Courier New,Courier,"Lucida Sans Typewriter","Lucida Typewriter",Monaco,Monospaced; margin-top: 1pt; margin-bottom: 1pt;}
|
||||
|
||||
.acronym
|
||||
{ font-weight: bold; }
|
||||
|
||||
.related
|
||||
{ font-weight: bold; margin-top:20pt; border-top: 1px solid black;}
|
||||
|
||||
.emph, .menuitem, .keycode
|
||||
{ font-weight: bold; }
|
||||
|
||||
.tablehead, .tableheadintable
|
||||
{ font-weight: bold; margin-top: 0px;}
|
||||
|
||||
.howtogetheader
|
||||
{ font-weight: bold; padding: 3px;}
|
||||
|
||||
h1, h2, h3, h4, h5, h6
|
||||
{ margin-bottom: 5pt; }
|
||||
|
||||
p, td
|
||||
{ font-size: 10pt; }
|
||||
|
||||
h1
|
||||
{ font-size: 18pt; border-bottom: 1px solid black; padding-bottom: 6px; margin-bottom: 6px;}
|
||||
|
||||
h2
|
||||
{ font-size: 14pt; }
|
||||
|
||||
h3
|
||||
{ font-size: 12pt; }
|
||||
|
||||
h4, h5, h6
|
||||
{ font-size: 10pt; }
|
||||
|
||||
.relatedtopics
|
||||
{ font-weight: normal; }
|
||||
|
||||
.relatedbody
|
||||
{ margin-top: 2px; margin-bottom: 2px; margin-left: 5px; }
|
||||
|
||||
.wide
|
||||
{ width: 100%; }
|
||||
|
||||
.topalign
|
||||
{ vertical-align: top; border: 1px;}
|
||||
|
||||
.bug
|
||||
{ color: red; border: 1px solid red;}
|
||||
|
||||
.debug
|
||||
{ border: 1px solid black; padding: 3px; display: none;}
|
||||
|
||||
/* HIGH CONTRAST SPECIFIC SETTINGS */
|
||||
|
||||
body, p, h1, h2, h3, h4, h5, h6, .listitem, .listitemintable, .tablecontent, .tablecontentintable
|
||||
{ background: #000000; color: #FFFFFF;}
|
||||
|
||||
.related
|
||||
{ border-top: 1px solid #FFFFFF; }
|
||||
|
||||
.howtogetheader
|
||||
{border: 1px solid #FFFFFF; background: #000000;}
|
||||
|
||||
h1
|
||||
{ border-bottom: 1px solid #FFFFFF; ]
|
||||
|
||||
.howtoget
|
||||
{ background:#000000;}
|
||||
|
||||
.howtogetbody
|
||||
{ background:#000000;}
|
||||
|
||||
.debug
|
||||
{ border: 1px solid red; padding: 3px; display: none;}
|
||||
|
||||
a
|
||||
{ color: #FFFFFF; }
|
||||
@@ -0,0 +1,114 @@
|
||||
/**************************************************************
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you 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 limitations
|
||||
* under the License.
|
||||
*
|
||||
*************************************************************/
|
||||
|
||||
/*
|
||||
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
+ OPENOFFICE.ORG 2.0 HELP +
|
||||
+ HIGH CONTRAST WHITE STYLESHEET +
|
||||
+ CHINESE SIMPL +
|
||||
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
+ LAST CHANGES: 24-MAR-2005 +
|
||||
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
*/
|
||||
|
||||
|
||||
body, p, h1, h2, h3, h4, h5, h6, .listitem, .listitemintable, .tablecontent, .tablecontentintable
|
||||
{ font-family: 方正宋体,"MSung Light SC",SimSun,FZSongYi,FZShuSong,NSimSun,"Andale Sans UI","Arial Unicode MS","Lucida Sans Unicode",Song; }
|
||||
|
||||
.code, .codeintable, .example, .exampleintable, .literal, .literalintable, .path, .pathintable
|
||||
{ font-family: 方正宋体,"MSung Light SC",Cumberland,Courier New,Courier,"Lucida Sans Typewriter","Lucida Typewriter",Monaco,Monospaced; margin-top: 1pt; margin-bottom: 1pt;}
|
||||
|
||||
.acronym
|
||||
{ font-weight: bold; }
|
||||
|
||||
.related
|
||||
{ font-weight: bold; margin-top:20pt; border-top: 1px solid black;}
|
||||
|
||||
.emph, .menuitem, .keycode
|
||||
{ font-weight: bold; }
|
||||
|
||||
.tablehead, .tableheadintable
|
||||
{ font-weight: bold; margin-top: 0px;}
|
||||
|
||||
.howtogetheader
|
||||
{ font-weight: bold; padding: 3px;}
|
||||
|
||||
h1, h2, h3, h4, h5, h6
|
||||
{ margin-bottom: 5pt; }
|
||||
|
||||
p, td
|
||||
{ font-size: 10pt; }
|
||||
|
||||
h1
|
||||
{ font-size: 18pt; border-bottom: 1px solid black; padding-bottom: 6px; margin-bottom: 6px;}
|
||||
|
||||
h2
|
||||
{ font-size: 14pt; }
|
||||
|
||||
h3
|
||||
{ font-size: 12pt; }
|
||||
|
||||
h4, h5, h6
|
||||
{ font-size: 10pt; }
|
||||
|
||||
.relatedtopics
|
||||
{ font-weight: normal; }
|
||||
|
||||
.relatedbody
|
||||
{ margin-top: 2px; margin-bottom: 2px; margin-left: 5px; }
|
||||
|
||||
.wide
|
||||
{ width: 100%; }
|
||||
|
||||
.topalign
|
||||
{ vertical-align: top; border: 1px;}
|
||||
|
||||
.bug
|
||||
{ color: red; border: 1px solid red;}
|
||||
|
||||
.debug
|
||||
{ border: 1px solid black; padding: 3px; display: none;}
|
||||
|
||||
/* HIGH CONTRAST SPECIFIC SETTINGS */
|
||||
|
||||
body, p, h1, h2, h3, h4, h5, h6, .listitem, .listitemintable, .tablecontent, .tablecontentintable
|
||||
{ background: #FFFFFF; color: #000000;}
|
||||
|
||||
.related
|
||||
{ border-top: 1px solid #000000; }
|
||||
|
||||
.howtogetheader
|
||||
{border: 1px solid #000000; background: #FFFFFF;}
|
||||
|
||||
h1
|
||||
{ border-bottom: 1px solid #000000; ]
|
||||
|
||||
.howtoget
|
||||
{ background:#FFFFFF;}
|
||||
|
||||
.howtogetbody
|
||||
{ background:#FFFFFF;}
|
||||
|
||||
.debug
|
||||
{ border: 1px solid red; padding: 3px; display: none;}
|
||||
|
||||
a
|
||||
{ color: #000000; }
|
||||
30
jodconverter-web/src/main/office/help/zh-CN/sbasic.cfg
Normal file
30
jodconverter-web/src/main/office/help/zh-CN/sbasic.cfg
Normal file
@@ -0,0 +1,30 @@
|
||||
###############################################################
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you 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 limitations
|
||||
# under the License.
|
||||
#
|
||||
###############################################################
|
||||
|
||||
|
||||
Title=%PRODUCTNAME Basic
|
||||
|
||||
Language=zh-CN
|
||||
Order=7
|
||||
Start=text%2Fsbasic%2Fshared%2Fmain0601.xhp
|
||||
Heading=headingheading
|
||||
Program=BASIC
|
||||
07.07.04 00:00:00
|
||||
13052
jodconverter-web/src/main/office/help/zh-CN/sbasic.db
Normal file
13052
jodconverter-web/src/main/office/help/zh-CN/sbasic.db
Normal file
File diff suppressed because it is too large
Load Diff
4185
jodconverter-web/src/main/office/help/zh-CN/sbasic.ht
Normal file
4185
jodconverter-web/src/main/office/help/zh-CN/sbasic.ht
Normal file
File diff suppressed because it is too large
Load Diff
BIN
jodconverter-web/src/main/office/help/zh-CN/sbasic.idxl/_0.cfs
Normal file
BIN
jodconverter-web/src/main/office/help/zh-CN/sbasic.idxl/_0.cfs
Normal file
Binary file not shown.
BIN
jodconverter-web/src/main/office/help/zh-CN/sbasic.idxl/_0.cfx
Normal file
BIN
jodconverter-web/src/main/office/help/zh-CN/sbasic.idxl/_0.cfx
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
jodconverter-web/src/main/office/help/zh-CN/sbasic.jar
Normal file
BIN
jodconverter-web/src/main/office/help/zh-CN/sbasic.jar
Normal file
Binary file not shown.
2182
jodconverter-web/src/main/office/help/zh-CN/sbasic.key
Normal file
2182
jodconverter-web/src/main/office/help/zh-CN/sbasic.key
Normal file
File diff suppressed because it is too large
Load Diff
265
jodconverter-web/src/main/office/help/zh-CN/sbasic.tree
Normal file
265
jodconverter-web/src/main/office/help/zh-CN/sbasic.tree
Normal file
@@ -0,0 +1,265 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--***********************************************************
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you 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 limitations
|
||||
* under the License.
|
||||
*
|
||||
***********************************************************-->
|
||||
<tree_view version="24-Aug-2004">
|
||||
<help_section application="sbasic" id="07" title="宏和编程">
|
||||
<node id="0701" title="一般信息和用户界面的使用">
|
||||
<topic id="sbasic/text/sbasic/shared/main0601.xhp">%PRODUCTNAME Basic 帮助</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/01000000.xhp">使用 %PRODUCTNAME Basic 编程</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/00000002.xhp">%PRODUCTNAME Basic 词汇表</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/01010210.xhp">Basics</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/01020000.xhp">语法</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/01050000.xhp">%PRODUCTNAME Basic IDE</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/01030100.xhp">IDE 概况</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/01030200.xhp">Basic 编辑器</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/01050100.xhp">监视窗口</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/main0211.xhp">宏工具栏</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/05060700.xhp">宏</topic>
|
||||
</node>
|
||||
<node id="0702" title="命令引用">
|
||||
<topic id="sbasic/text/sbasic/shared/01020300.xhp">使用过程和函数</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/01020500.xhp">程序库、模块和对话框</topic>
|
||||
<node id="070202" title="运行时函数、语句和运算符">
|
||||
<topic id="sbasic/text/sbasic/shared/03010000.xhp">屏幕 I/O 函数</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03020000.xhp">文件 I/O 函数</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03030000.xhp">日期和时间函数</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03050000.xhp">错误处理函数</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03060000.xhp">逻辑运算符</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03070000.xhp">数学运算符</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03080000.xhp">数字函数</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03090000.xhp">控制程序的执行</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03100000.xhp">变量</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03110000.xhp">比较运算符</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03120000.xhp">字符串</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03130000.xhp">其他命令</topic>
|
||||
</node>
|
||||
<node id="070201" title="函数、语句和运算符的字母顺序列表">
|
||||
<topic id="sbasic/text/sbasic/shared/03080601.xhp">Abs 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03060100.xhp">AND 运算符 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03104200.xhp">Array 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03120101.xhp">Asc 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03080101.xhp">Atn 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03130100.xhp">Beep 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03010301.xhp">Blue 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03100100.xhp">CBool 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03120105.xhp">CByte 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03030108.xhp">CDateFromIso 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03030107.xhp">CdateToIso 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03100300.xhp">CDate 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03100400.xhp">CDbl 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03100500.xhp">CInt 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03100600.xhp">CLng 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03100900.xhp">CSng 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03101000.xhp">CStr 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03090401.xhp">Call 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03020401.xhp">ChDir 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03020402.xhp">ChDrive 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03090402.xhp">Choose 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03120102.xhp">Chr 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03020101.xhp">Close 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03110100.xhp">比较运算符 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03100700.xhp">Const 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03120313.xhp">ConvertFromURL 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03120312.xhp">ConvertToURL 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03080102.xhp">Cos 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03131800.xhp">CreateUnoDialog 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03132000.xhp">CreateUnoListener 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03131600.xhp">CreateUnoService 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03131500.xhp">CreateUnoStruct 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03020403.xhp">CurDir 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03030101.xhp">DateSerial 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03030102.xhp">DateValue 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03030301.xhp">Date 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03030103.xhp">Day 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03090403.xhp">Declare 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03101100.xhp">DefBool 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03101300.xhp">DefDate 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03101400.xhp">DefDbl 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03101500.xhp">DefInt 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03101600.xhp">DefLng 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03101700.xhp">DefObj 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03102000.xhp">DefVar 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03104300.xhp">DimArray 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03102100.xhp">Dim 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03020404.xhp">Dir 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03090201.xhp">Do...Loop 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03110100.xhp">比较运算符 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03090404.xhp">End 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03130800.xhp">Environ 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03020301.xhp">Eof 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03104600.xhp">EqualUnoObjects 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03060200.xhp">Eqv 运算符 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03050100.xhp">Erl 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03050200.xhp">Err 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03050300.xhp">Error 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03050000.xhp">错误处理函数</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03090412.xhp">Exit 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03080201.xhp">Exp 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03020405.xhp">FileAttr 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03020406.xhp">FileCopy 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03020407.xhp">FileDateTime 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03020415.xhp">FileExists 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03020408.xhp">FileLen 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03103800.xhp">FindObject 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03103900.xhp">FindPropertyObject 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03080501.xhp">Fix 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03090202.xhp">For...Next 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03120301.xhp">Format 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03020102.xhp">FreeFile 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03090405.xhp">FreeLibrary 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03090406.xhp">Function 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03090400.xhp">其他语句</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03080300.xhp">生成随机数</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03020409.xhp">GetAttr 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03131700.xhp">GetProcessServiceManager 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03131000.xhp">GetSolarVersion 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03130700.xhp">GetSystemTicks 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03020201.xhp">Get 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03131900.xhp">GlobalScope [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03090301.xhp">GoSub...Return 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03090302.xhp">GoTo 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03010302.xhp">Green 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03104400.xhp">HasUnoInterfaces 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03080801.xhp">Hex 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03030201.xhp">Hour 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03090103.xhp">IIf 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03090101.xhp">If...Then...Else 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03060300.xhp">隐含运算符 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03120401.xhp">InStr 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03010201.xhp">InputBox 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03020202.xhp">Input# 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03080502.xhp">Int 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03102200.xhp">IsArray 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03102300.xhp">IsDate 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03102400.xhp">IsEmpty 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03104000.xhp">IsMissing 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03102600.xhp">IsNull 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03102700.xhp">IsNumeric 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03102800.xhp">IsObject 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03104500.xhp">IsUnoStruct 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03120315.xhp">Join 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03020410.xhp">Kill 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03102900.xhp">LBound 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03120302.xhp">LCase 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03120304.xhp">LSet 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03120305.xhp">LTrim 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03120303.xhp">Left 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03120402.xhp">Len 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03103100.xhp">Let 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03020203.xhp">Line Input # 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03020302.xhp">Loc 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03020303.xhp">Lof 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03080202.xhp">Log 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03120306.xhp">Mid 函数、Mid 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03030202.xhp">Minute 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03020411.xhp">MkDir 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03070600.xhp">Mod 运算符 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03030104.xhp">Month 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03010102.xhp">MsgBox 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03010101.xhp">MsgBox 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03020412.xhp">Name 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03060400.xhp">"Not"运算符 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03030203.xhp">Now 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03080000.xhp">数字函数</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03080802.xhp">Oct 函数 [运行时间]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03050500.xhp">On Error GoTo ...Resume 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03090303.xhp">On...GoSub 语句;On...GoTo 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03020103.xhp">Open 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03103200.xhp">Option Base 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03103300.xhp">Option Explicit 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03104100.xhp">Optional(在函数语句中)[运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03060500.xhp">Or 运算符 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03010103.xhp">Print 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03103400.xhp">Public 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03020204.xhp">Put 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03010304.xhp">QBColor 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03010305.xhp">RGB 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03120308.xhp">RSet 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03120309.xhp">RTrim 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03080301.xhp">Randomize 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03102101.xhp">ReDim 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03010303.xhp">Red 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03090407.xhp">Rem 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03020104.xhp">Reset 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03120307.xhp">Right 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03020413.xhp">RmDir 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03080302.xhp">Rnd 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03030204.xhp">Second 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03020304.xhp">Seek 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03020305.xhp">Seek 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03090102.xhp">Select...Case 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03020414.xhp">SetAttr 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03103700.xhp">Set 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03080701.xhp">Sgn 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03130500.xhp">Shell 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03080103.xhp">Sin 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03120201.xhp">Space 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03120314.xhp">Split 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03080401.xhp">Sqr 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03080400.xhp">计算平方根</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03103500.xhp">Static 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03090408.xhp">Stop 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03120403.xhp">StrComp 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03120103.xhp">Str 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03120202.xhp">String 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03090409.xhp">Sub 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03090410.xhp">Switch 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03080104.xhp">Tan 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03030205.xhp">TimeSerial 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03030206.xhp">TimeValue 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03030302.xhp">Time 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03030303.xhp">Timer 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03080100.xhp">三角函数</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03120311.xhp">Trim 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03131300.xhp">TwipsPerPixelX 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03131400.xhp">TwipsPerPixelY 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03103600.xhp">TypeName 函数; VarType 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03103000.xhp">UBound 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03120310.xhp">UCase 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03120104.xhp">Val 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03130600.xhp">Wait 语句 [运行时间]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03030105.xhp">WeekDay 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03090203.xhp">While...Wend 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03090411.xhp">With 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03020205.xhp">Write 语句 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03060600.xhp">Xor 运算符 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03030106.xhp">Year 函数 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03070100.xhp">"-" 运算符 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03070200.xhp">"*" 运算符 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03070300.xhp">"+" 运算符 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03070400.xhp">"/" 运算符 [运行时]</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/03070500.xhp">"^" 运算符 [运行时]</topic>
|
||||
</node>
|
||||
</node>
|
||||
<node id="0703" title="指南">
|
||||
<topic id="sbasic/text/sbasic/guide/control_properties.xhp">修改对话框编辑器中控件的属性</topic>
|
||||
<topic id="sbasic/text/sbasic/guide/insert_control.xhp">在对话框编辑器中创建控件</topic>
|
||||
<topic id="sbasic/text/sbasic/guide/sample_code.xhp">对话框编辑器中控件的编程示例</topic>
|
||||
<topic id="sbasic/text/sbasic/guide/show_dialog.xhp">通过程序代码打开对话框</topic>
|
||||
<topic id="sbasic/text/sbasic/guide/create_dialog.xhp">创建 Basic 对话框</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/01030400.xhp">管理库和模块</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/01020100.xhp">使用变量</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/01020200.xhp">使用对象</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/01030300.xhp">调试 Basic 程序</topic>
|
||||
<topic id="sbasic/text/sbasic/shared/01040000.xhp">事件驱动的宏</topic>
|
||||
</node>
|
||||
</help_section>
|
||||
</tree_view>
|
||||
30
jodconverter-web/src/main/office/help/zh-CN/scalc.cfg
Normal file
30
jodconverter-web/src/main/office/help/zh-CN/scalc.cfg
Normal file
@@ -0,0 +1,30 @@
|
||||
###############################################################
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you 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 limitations
|
||||
# under the License.
|
||||
#
|
||||
###############################################################
|
||||
|
||||
|
||||
Title=%PRODUCTNAME Calc
|
||||
|
||||
Language=zh-CN
|
||||
Order=3
|
||||
Start=text%2Fscalc%2Fmain0000.xhp
|
||||
Heading=headingheading
|
||||
Program=CALC
|
||||
07.07.04 00:00:00
|
||||
14554
jodconverter-web/src/main/office/help/zh-CN/scalc.db
Normal file
14554
jodconverter-web/src/main/office/help/zh-CN/scalc.db
Normal file
File diff suppressed because it is too large
Load Diff
5370
jodconverter-web/src/main/office/help/zh-CN/scalc.ht
Normal file
5370
jodconverter-web/src/main/office/help/zh-CN/scalc.ht
Normal file
File diff suppressed because it is too large
Load Diff
BIN
jodconverter-web/src/main/office/help/zh-CN/scalc.idxl/_0.cfs
Normal file
BIN
jodconverter-web/src/main/office/help/zh-CN/scalc.idxl/_0.cfs
Normal file
Binary file not shown.
BIN
jodconverter-web/src/main/office/help/zh-CN/scalc.idxl/_0.cfx
Normal file
BIN
jodconverter-web/src/main/office/help/zh-CN/scalc.idxl/_0.cfx
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
jodconverter-web/src/main/office/help/zh-CN/scalc.jar
Normal file
BIN
jodconverter-web/src/main/office/help/zh-CN/scalc.jar
Normal file
Binary file not shown.
3312
jodconverter-web/src/main/office/help/zh-CN/scalc.key
Normal file
3312
jodconverter-web/src/main/office/help/zh-CN/scalc.key
Normal file
File diff suppressed because it is too large
Load Diff
190
jodconverter-web/src/main/office/help/zh-CN/scalc.tree
Normal file
190
jodconverter-web/src/main/office/help/zh-CN/scalc.tree
Normal file
@@ -0,0 +1,190 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--***********************************************************
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you 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 limitations
|
||||
* under the License.
|
||||
*
|
||||
***********************************************************-->
|
||||
<tree_view version="24-Aug-2004">
|
||||
<help_section application="scalc" id="08" title="电子表格">
|
||||
<node id="0801" title="一般信息和用户界面的使用">
|
||||
<topic id="scalc/text/scalc/main0000.xhp">欢迎使用 %PRODUCTNAME Calc 帮助</topic>
|
||||
<topic id="scalc/text/scalc/main0503.xhp">%PRODUCTNAME Calc 功能</topic>
|
||||
<topic id="scalc/text/scalc/guide/keyboard.xhp">快捷键(%PRODUCTNAME Calc 辅助功能)</topic>
|
||||
<topic id="scalc/text/scalc/04/01020000.xhp">电子表格的快捷键</topic>
|
||||
<topic id="scalc/text/scalc/05/02140000.xhp">%PRODUCTNAME Calc 中的错误代码</topic>
|
||||
<topic id="scalc/text/scalc/01/04060112.xhp">%PRODUCTNAME Calc 中用于编程的加载宏</topic>
|
||||
<topic id="scalc/text/scalc/guide/main.xhp">%PRODUCTNAME Calc 使用说明</topic>
|
||||
</node>
|
||||
<node id="0802" title="命令和菜单引用">
|
||||
<node id="080201" title="菜单">
|
||||
<topic id="scalc/text/scalc/main0100.xhp">菜单</topic>
|
||||
<topic id="scalc/text/scalc/main0101.xhp">文件</topic>
|
||||
<topic id="scalc/text/scalc/main0102.xhp">编辑</topic>
|
||||
<topic id="scalc/text/scalc/main0103.xhp">视图</topic>
|
||||
<topic id="scalc/text/scalc/main0104.xhp">插入</topic>
|
||||
<topic id="scalc/text/scalc/main0105.xhp">格式</topic>
|
||||
<topic id="scalc/text/scalc/main0106.xhp">工具</topic>
|
||||
<topic id="scalc/text/scalc/main0107.xhp">窗口</topic>
|
||||
<topic id="scalc/text/scalc/main0112.xhp">数据</topic>
|
||||
</node>
|
||||
<node id="080202" title="工具栏">
|
||||
<topic id="scalc/text/scalc/main0200.xhp">工具栏</topic>
|
||||
<topic id="scalc/text/scalc/main0202.xhp">格式栏</topic>
|
||||
<topic id="scalc/text/scalc/main0203.xhp">绘图对象属性栏</topic>
|
||||
<topic id="scalc/text/scalc/main0205.xhp">文字格式栏</topic>
|
||||
<topic id="scalc/text/scalc/main0206.xhp">公式栏</topic>
|
||||
<topic id="scalc/text/scalc/main0208.xhp">状态栏</topic>
|
||||
<topic id="scalc/text/scalc/main0210.xhp">打印预览栏</topic>
|
||||
<topic id="scalc/text/scalc/main0214.xhp">图片栏</topic>
|
||||
<topic id="scalc/text/scalc/main0218.xhp">工具栏</topic>
|
||||
<topic id="shared/text/shared/main0201.xhp">标准栏</topic>
|
||||
<topic id="shared/text/shared/main0209.xhp">超链接地址栏</topic>
|
||||
<topic id="shared/text/shared/main0212.xhp">表格数据栏</topic>
|
||||
<topic id="shared/text/shared/main0213.xhp">窗体导航栏</topic>
|
||||
<topic id="shared/text/shared/main0214.xhp">查询设计栏</topic>
|
||||
<topic id="shared/text/shared/main0226.xhp">窗体设计工具栏</topic>
|
||||
</node>
|
||||
</node>
|
||||
<node id="0803" title="函数类型和运算符">
|
||||
<topic id="scalc/text/scalc/01/04060000.xhp">函数向导</topic>
|
||||
<topic id="scalc/text/scalc/01/04060100.xhp">函数(按类别)</topic>
|
||||
<topic id="scalc/text/scalc/01/04060101.xhp">数据库函数</topic>
|
||||
<topic id="scalc/text/scalc/01/04060102.xhp">日期和时间函数</topic>
|
||||
<topic id="scalc/text/scalc/01/04060103.xhp">财务函数第一部分</topic>
|
||||
<topic id="scalc/text/scalc/01/04060119.xhp">财务函数第二部分</topic>
|
||||
<topic id="scalc/text/scalc/01/04060118.xhp">金融函数第三部分</topic>
|
||||
<topic id="scalc/text/scalc/01/04060104.xhp">信息函数</topic>
|
||||
<topic id="scalc/text/scalc/01/04060105.xhp">逻辑函数</topic>
|
||||
<topic id="scalc/text/scalc/01/04060106.xhp">数学函数</topic>
|
||||
<topic id="scalc/text/scalc/01/04060107.xhp">矩阵函数</topic>
|
||||
<topic id="scalc/text/scalc/01/04060108.xhp">统计函数</topic>
|
||||
<topic id="scalc/text/scalc/01/04060181.xhp">统计函数第一部分</topic>
|
||||
<topic id="scalc/text/scalc/01/04060182.xhp">统计函数第二部分</topic>
|
||||
<topic id="scalc/text/scalc/01/04060183.xhp">统计函数第三部分</topic>
|
||||
<topic id="scalc/text/scalc/01/04060184.xhp">统计函数第四部分</topic>
|
||||
<topic id="scalc/text/scalc/01/04060185.xhp">统计函数第五部分</topic>
|
||||
<topic id="scalc/text/scalc/01/04060109.xhp">电子表格函数</topic>
|
||||
<topic id="scalc/text/scalc/01/04060110.xhp">文字函数</topic>
|
||||
<topic id="scalc/text/scalc/01/04060111.xhp">加载宏函数</topic>
|
||||
<topic id="scalc/text/scalc/01/04060115.xhp">加载宏函数,分析函数列表第一部分</topic>
|
||||
<topic id="scalc/text/scalc/01/04060116.xhp">加载宏函数,分析函数列表第二部分</topic>
|
||||
|
||||
<topic id="scalc/text/scalc/01/04060199.xhp">%PRODUCTNAME Calc 中的运算符</topic>
|
||||
<topic id="scalc/text/scalc/guide/userdefined_function.xhp">自定义函数</topic>
|
||||
</node>
|
||||
<node id="0804" title="加载、保存、导入和导出">
|
||||
<topic id="scalc/text/scalc/guide/webquery.xhp">在表格中插入外部数据 (WebQuery)</topic>
|
||||
<topic id="scalc/text/scalc/guide/html_doc.xhp">将工作表以 HTML 格式保存和打开</topic>
|
||||
<topic id="scalc/text/scalc/guide/csv_formula.xhp">导入和导出文本文件</topic>
|
||||
</node>
|
||||
<node id="0805" title="格式化">
|
||||
<topic id="scalc/text/scalc/guide/text_rotate.xhp">旋转文字</topic>
|
||||
<topic id="scalc/text/scalc/guide/text_wrap.xhp">写入多行文字</topic>
|
||||
<topic id="scalc/text/scalc/guide/text_numbers.xhp">将数字格式化为文本</topic>
|
||||
<topic id="scalc/text/scalc/guide/super_subscript.xhp">文字上标/下标</topic>
|
||||
<topic id="scalc/text/scalc/guide/row_height.xhp">改变行高或列宽</topic>
|
||||
<topic id="scalc/text/scalc/guide/cellstyle_conditional.xhp">应用条件格式</topic>
|
||||
<topic id="scalc/text/scalc/guide/cellstyle_minusvalue.xhp">突出显示负数</topic>
|
||||
<topic id="scalc/text/scalc/guide/cellstyle_by_formula.xhp">根据公式指定的格式</topic>
|
||||
<topic id="scalc/text/scalc/guide/integer_leading_zero.xhp">输入带前置零的数字</topic>
|
||||
<topic id="scalc/text/scalc/guide/format_table.xhp">格式化电子表格</topic>
|
||||
<topic id="scalc/text/scalc/guide/format_value.xhp">格式化带小数的数字</topic>
|
||||
<topic id="scalc/text/scalc/guide/value_with_name.xhp">命名单元格</topic>
|
||||
<topic id="scalc/text/scalc/guide/table_rotate.xhp">旋转表格(转置)</topic>
|
||||
<topic id="scalc/text/scalc/guide/rename_table.xhp">重命名工作表</topic>
|
||||
<topic id="scalc/text/scalc/guide/year2000.xhp">19xx/20xx 年</topic>
|
||||
<topic id="scalc/text/scalc/guide/rounding_numbers.xhp">使用四舍五入的数字</topic>
|
||||
<topic id="scalc/text/scalc/guide/currency_format.xhp">采用货币格式的单元格</topic>
|
||||
<topic id="scalc/text/scalc/guide/autoformat.xhp">对表格使用自动套用格式</topic>
|
||||
<topic id="scalc/text/scalc/guide/note_insert.xhp">插入和编辑批注</topic>
|
||||
<topic id="scalc/text/scalc/guide/design.xhp">选择工作表主题</topic>
|
||||
<topic id="scalc/text/scalc/guide/fraction_enter.xhp">输入分数</topic>
|
||||
</node>
|
||||
<node id="0806" title="筛选和排序">
|
||||
<topic id="scalc/text/scalc/guide/filters.xhp">应用筛选</topic>
|
||||
<topic id="scalc/text/scalc/guide/specialfilter.xhp">筛选:应用高级筛选</topic>
|
||||
<!-- removed scalc/text/scalc/guide/standardfilter.xhp -->
|
||||
<topic id="scalc/text/scalc/guide/autofilter.xhp">应用自动筛选</topic>
|
||||
<topic id="scalc/text/scalc/guide/sorted_list.xhp">应用排序列表</topic>
|
||||
</node>
|
||||
<node id="0807" title="打印">
|
||||
<topic id="scalc/text/scalc/guide/print_title_row.xhp">在每一页上打印行或列</topic>
|
||||
<topic id="scalc/text/scalc/guide/print_landscape.xhp">横向打印工作表</topic>
|
||||
<topic id="scalc/text/scalc/guide/print_details.xhp">打印工作表详细资料</topic>
|
||||
<topic id="scalc/text/scalc/guide/print_exact.xhp">定义打印的页数</topic>
|
||||
</node>
|
||||
<node id="0808" title="数据区域">
|
||||
<topic id="scalc/text/scalc/guide/database_define.xhp">定义数据库区域</topic>
|
||||
<topic id="scalc/text/scalc/guide/database_filter.xhp">过滤单元格范围</topic>
|
||||
<!-- removed scalc/text/scalc/guide/database_group.xhp -->
|
||||
<topic id="scalc/text/scalc/guide/database_sort.xhp">数据排序 </topic>
|
||||
</node>
|
||||
<node id="0809" title="数据透视表">
|
||||
<topic id="scalc/text/scalc/guide/datapilot.xhp">数据透视表</topic>
|
||||
<topic id="scalc/text/scalc/guide/datapilot_createtable.xhp">创建数据透视表</topic>
|
||||
<topic id="scalc/text/scalc/guide/datapilot_deletetable.xhp">删除数据透视表</topic>
|
||||
<topic id="scalc/text/scalc/guide/datapilot_edittable.xhp">编辑数据透视表</topic>
|
||||
<topic id="scalc/text/scalc/guide/datapilot_filtertable.xhp">筛选数据透视表</topic>
|
||||
<topic id="scalc/text/scalc/guide/datapilot_tipps.xhp">选择数据透视表输出范围</topic>
|
||||
<topic id="scalc/text/scalc/guide/datapilot_updatetable.xhp">更新数据透视表</topic>
|
||||
</node>
|
||||
<node id="0810" title="方案">
|
||||
<topic id="scalc/text/scalc/guide/scenario.xhp">使用方案</topic>
|
||||
</node>
|
||||
<node id="0811" title="引用">
|
||||
<topic id="scalc/text/scalc/guide/relativ_absolut_ref.xhp">地址和引用,绝对和相对</topic>
|
||||
<topic id="scalc/text/scalc/guide/cellreferences.xhp">引用其他文档中的单元格</topic>
|
||||
<topic id="scalc/text/scalc/guide/cellreferences_url.xhp">引用其他工作表和参考 URL</topic>
|
||||
<topic id="scalc/text/scalc/guide/cellreference_dragdrop.xhp">通过拖放来引用单元格</topic>
|
||||
<topic id="scalc/text/scalc/guide/address_auto.xhp">寻址时识别名称</topic>
|
||||
</node>
|
||||
<node id="0812" title="查看、选择和复制">
|
||||
<topic id="scalc/text/scalc/guide/table_view.xhp">修改表格视图</topic>
|
||||
<topic id="scalc/text/scalc/guide/formula_value.xhp">显示公式或数值</topic>
|
||||
<topic id="scalc/text/scalc/guide/line_fix.xhp">行或列作为标题固定</topic>
|
||||
<topic id="scalc/text/scalc/guide/multi_tables.xhp">浏览工作表标签</topic>
|
||||
<topic id="scalc/text/scalc/guide/edit_multitables.xhp">复制到多个工作表</topic>
|
||||
<topic id="scalc/text/scalc/guide/cellcopy.xhp">仅复制可见单元格</topic>
|
||||
<topic id="scalc/text/scalc/guide/mark_cells.xhp">选择多个单元格</topic>
|
||||
</node>
|
||||
<node id="0813" title="公式和计算">
|
||||
<topic id="scalc/text/scalc/guide/formulas.xhp">通过公式计算</topic>
|
||||
<topic id="scalc/text/scalc/guide/formula_copy.xhp">复制公式</topic>
|
||||
<topic id="scalc/text/scalc/guide/formula_enter.xhp">输入公式</topic>
|
||||
<topic id="scalc/text/scalc/guide/formula_value.xhp">显示公式或数值</topic>
|
||||
<topic id="scalc/text/scalc/guide/calculate.xhp">电子表格中的计算</topic>
|
||||
<topic id="scalc/text/scalc/guide/calc_date.xhp">使用日期和时间进行计算</topic>
|
||||
<topic id="scalc/text/scalc/guide/calc_series.xhp">自动计算序列</topic>
|
||||
<topic id="scalc/text/scalc/guide/calc_timevalues.xhp">计算时差</topic>
|
||||
<topic id="scalc/text/scalc/guide/matrixformula.xhp">输入矩阵公式</topic>
|
||||
</node>
|
||||
<node id="0814" title="保护">
|
||||
<topic id="scalc/text/scalc/guide/cell_protect.xhp">保护单元格不被修改</topic>
|
||||
<topic id="scalc/text/scalc/guide/cell_unprotect.xhp">取消单元格保护</topic>
|
||||
</node>
|
||||
<node id="0815" title="其他">
|
||||
<!-- removed scalc/text/scalc/guide/autofill.xhp -->
|
||||
<topic id="scalc/text/scalc/guide/auto_off.xhp">停用自动修改</topic>
|
||||
<topic id="scalc/text/scalc/guide/consolidate.xhp">合并计算数据</topic>
|
||||
<topic id="scalc/text/scalc/guide/goalseek.xhp">应用单变量求解</topic>
|
||||
<topic id="scalc/text/scalc/guide/multioperation.xhp">应用多重计算</topic>
|
||||
<topic id="scalc/text/scalc/guide/multitables.xhp">应用多个工作表</topic>
|
||||
<topic id="scalc/text/scalc/guide/validity.xhp">单元格内容的有效性</topic>
|
||||
</node>
|
||||
</help_section>
|
||||
</tree_view>
|
||||
30
jodconverter-web/src/main/office/help/zh-CN/schart.cfg
Normal file
30
jodconverter-web/src/main/office/help/zh-CN/schart.cfg
Normal file
@@ -0,0 +1,30 @@
|
||||
###############################################################
|
||||
#
|
||||
# Licensed to the Apache Software Foundation (ASF) under one
|
||||
# or more contributor license agreements. See the NOTICE file
|
||||
# distributed with this work for additional information
|
||||
# regarding copyright ownership. The ASF licenses this file
|
||||
# to you 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 limitations
|
||||
# under the License.
|
||||
#
|
||||
###############################################################
|
||||
|
||||
Title=%PRODUCTNAME Chart
|
||||
|
||||
Language=zh-CN
|
||||
Order=4
|
||||
Start=text%2Fschart%2Fmain0000.xhp
|
||||
Heading=headingheading
|
||||
Program=CHART
|
||||
07.07.04 00:00:00
|
||||
|
||||
12590
jodconverter-web/src/main/office/help/zh-CN/schart.db
Normal file
12590
jodconverter-web/src/main/office/help/zh-CN/schart.db
Normal file
File diff suppressed because it is too large
Load Diff
4409
jodconverter-web/src/main/office/help/zh-CN/schart.ht
Normal file
4409
jodconverter-web/src/main/office/help/zh-CN/schart.ht
Normal file
File diff suppressed because it is too large
Load Diff
BIN
jodconverter-web/src/main/office/help/zh-CN/schart.idxl/_0.cfs
Normal file
BIN
jodconverter-web/src/main/office/help/zh-CN/schart.idxl/_0.cfs
Normal file
Binary file not shown.
BIN
jodconverter-web/src/main/office/help/zh-CN/schart.idxl/_0.cfx
Normal file
BIN
jodconverter-web/src/main/office/help/zh-CN/schart.idxl/_0.cfx
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
jodconverter-web/src/main/office/help/zh-CN/schart.jar
Normal file
BIN
jodconverter-web/src/main/office/help/zh-CN/schart.jar
Normal file
Binary file not shown.
1926
jodconverter-web/src/main/office/help/zh-CN/schart.key
Normal file
1926
jodconverter-web/src/main/office/help/zh-CN/schart.key
Normal file
File diff suppressed because it is too large
Load Diff
30
jodconverter-web/src/main/office/help/zh-CN/schart.tree
Normal file
30
jodconverter-web/src/main/office/help/zh-CN/schart.tree
Normal file
@@ -0,0 +1,30 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--***********************************************************
|
||||
*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one
|
||||
* or more contributor license agreements. See the NOTICE file
|
||||
* distributed with this work for additional information
|
||||
* regarding copyright ownership. The ASF licenses this file
|
||||
* to you 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 limitations
|
||||
* under the License.
|
||||
*
|
||||
***********************************************************-->
|
||||
<tree_view version="24-Aug-2004">
|
||||
<help_section application="scalc" id="05" title="图表和图解">
|
||||
<node id="0501" title="一般信息">
|
||||
<topic id="schart/text/schart/main0000.xhp">%PRODUCTNAME 中的图表</topic>
|
||||
<topic id="schart/text/schart/main0503.xhp">%PRODUCTNAME 图表功能</topic>
|
||||
<topic id="schart/text/schart/04/01020000.xhp">图表的快捷键</topic>
|
||||
</node>
|
||||
</help_section>
|
||||
</tree_view>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user