office办公文档doc、docx、xls、xlsx、ppt、pptx在线预览解决方案二,openOffice详细安装

详细安装openOffice

注意:如果转换需要使用中文,就必须安装中文字体,安装完成后重启openOffice,可能出现无法重启,需要重新启动服务器情况,所有为了保险起见正式服务器上安装openOffice,请优先安装中文字体,防止有些主机安装完字体后无法重启openoffice服务

当前主机环境:jdk1.8 centos7.5 (ubuntu安装时候命令只有一小点差异,步骤不变)

下载openoffice http://www.openoffice.org/zh-cn/download/ 点击下载
在这里插入图片描述
下载完成后解压
在这里插入图片描述
解压后文件 解压后进入zh-CN
在这里插入图片描述
cd RPMS/ 里面都是rpm文件,我们需要安装这些文件
在这里插入图片描述
安装rpm文件: rpm -ivh *.rpm 执行全量安装
在这里插入图片描述
切换回桌面
cd desktop-integration
在这里插入图片描述
执行安装openOffice菜单
rpm -ivh openoffice4.1.7-redhat-menus-4.1.7-9800.noarch.rpm
在这里插入图片描述
切换到默认安装目录
cd /opt/openoffice4/program

守护进程启动服务 默认8100
nohup soffice -headless -accept=“socket,host=127.0.0.1,port=8100;urp;” -nofirststartwizard &

输出打印信息
tail -f nohup.out

启动报错
在这里插入图片描述
错误2
在这里插入图片描述
解决当前我能遇到的异常错误
/opt/openoffice4/program

解决失败问题

openoffice4

如果错误为:# no suitable windowing system found, exiting

解决:# yum groupinstall “X Window System”

如果错误为:#/opt/openoffice4/program/soffice.bin: error while loading shared libraries: libXext.so.6: cannot open shared object file: No such file or directory

解决:将libXext.so.6从/usr/lib64或者/usr/lib中复制过来,也没有就安装# yum install libXext.x86_64

如果错误为:# /opt/openoffice4/program/soffice.bin: error while loading shared libraries: libfreetype.so.6: cannot open shared object file: No such file or directory

解决:将libfreetype.so.6从/usr/lib64或者/usr/lib中复制过来,也没有就安装# yum install freetype

如:执行移动so文件操作
在这里插入图片描述
再次执行启动操作
切换到默认安装目录
cd /opt/openoffice4/program

守护进程启动服务 默认8100
nohup soffice -headless -accept=“socket,host=127.0.0.1,port=8100;urp;” -nofirststartwizard &

查看启动是否成功
ps -ef|grep office
netstat -ano | grep 8100
在这里插入图片描述

---------到此openOffice全部安装成功------------

卸载openOffice
rpm -e rpm -qa |grep openoffice rpm -qa |grep ooobasis

查询是否卸载完成
rpm -qa |grep office

如果没有退出即可

如果有未完成的列表 参考卸载命令
rpm -e openoffice-ure-4.1.7-9702


另一种是使用deb格式进行安装,Ubuntu系统我常用习惯,安装只是安装命令不同,操作步骤一致
在下载openOffice软件时候选择.deb格式的软件包
在这里插入图片描述

1、同样解压【参考上述解压】
2、进入zh-CN/DEBS 目录下, 然后执行命令进行安装
dpkg -i *.deb
3、进入到桌面菜单目录
cd desktop-integration
4、执行安装菜单
dpkg -i openoffice4.1.7-redhat-menus-4.1.7-9800.noarch.deb

—到此openOffice全部安装成功 安装上述启动步骤和解决错误问题即可开启openOffice服务----

移动到该系列其他文章
office办公文档doc、docx、xls、xlsx、ppt、pptx在线预览解决方案一,背景==>
office办公文档doc、docx、xls、xlsx、ppt、pptx在线预览解决方案二,openOffice详细安装==>
office办公文档doc、docx、xls、xlsx、ppt、pptx在线预览解决方案三,实现预览==>

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
在Vue中预览docxdoc、pdf、xlsxlsx文件,可以使用第三方库来实现。 对于docxdocxlsxlsx文件,可以使用`js-xlsx`库来进行解析和预览。该库可以将Excel文件转换为JSON格式,而对于Word文件,可以使用`docx.js`库来进行解析和预览。 对于pdf文件,可以使用`pdf.js`库来进行预览。该库可以通过Canvas将PDF文件渲染成图片,然后在Vue中显示。 下面是一个示例代码,演示如何使用上述库来预览不同类型的文件: ```html <template> <div> <div v-if="fileType === 'docx' || fileType === 'doc'"> <div v-html="docContent"></div> </div> <div v-else-if="fileType === 'xls' || fileType === 'xlsx'"> <table> <tr v-for="row in excelData"> <td v-for="cell in row">{{ cell }}</td> </tr> </table> </div> <div v-else-if="fileType === 'pdf'"> <canvas ref="pdfCanvas"></canvas> </div> </div> </template> <script> import XLSX from 'xlsx'; import Docx from 'docx'; import pdfjsLib from 'pdfjs-dist'; export default { data() { return { fileType: '', docContent: '', excelData: [], }; }, mounted() { // 根据文件类型进行解析和预览 if (this.fileType === 'docx' || this.fileType === 'doc') { const reader = new FileReader(); reader.onload = (event) => { const content = event.target.result; const doc = new Docx(); doc.load(content); this.docContent = doc.getHtml(); }; reader.readAsArrayBuffer(this.file); } else if (this.fileType === 'xls' || this.fileType === 'xlsx') { const reader = new FileReader(); reader.onload = (event) => { const content = event.target.result; const workbook = XLSX.read(content, { type: 'array' }); const sheetName = workbook.SheetNames[0]; const worksheet = workbook.Sheets[sheetName]; this.excelData = XLSX.utils.sheet_to_json(worksheet, { header: 1 }); }; reader.readAsArrayBuffer(this.file); } else if (this.fileType === 'pdf') { const canvas = this.$refs.pdfCanvas; const ctx = canvas.getContext('2d'); pdfjsLib.getDocument(this.file).promise.then((pdf) => { pdf.getPage(1).then((page) => { const viewport = page.getViewport({ scale: 1.5 }); canvas.height = viewport.height; canvas.width = viewport.width; page.render({ canvasContext: ctx, viewport, }); }); }); } }, props: { file: { type: File, required: true, }, }, created() { // 根据文件后缀名判断文件类型 const fileExtension = this.file.name.split('.').pop(); if (fileExtension === 'docx' || fileExtension === 'doc') { this.fileType = 'docx'; } else if (fileExtension === 'xls' || fileExtension === 'xlsx') { this.fileType = 'xls'; } else if (fileExtension === 'pdf') { this.fileType = 'pdf'; } }, }; </script> ``` 在上述代码中,根据文件后缀名判断文件类型,然后使用不同的库进行解析和预览。对于Word文件,使用`docx.js`库将文件解析为HTML格式,然后在Vue中显示;对于Excel文件,使用`js-xlsx`库将文件解析为JSON格式,然后在Vue中生成表格;对于PDF文件,使用`pdf.js`库将文件渲染成图片,然后在Vue中显示。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值