专业的编程技术博客社区

网站首页 > 博客文章 正文

Confluence中Office预览中文乱码(文件预览是乱码)

baijin 2024-09-21 13:00:28 博客文章 3 ℃ 0 评论

1. 现象

Confluence预览Word时出现乱码

  • Centos 7 系统
  • Windows下查看Confluence

2. 原因分析

Confluence所在服务器缺少Windows相应字体

3. 解决方法

参考文档:The text in a PowerPoint, Excel or Word Document is missing or looks different via Confluence View File macro | Confluence | Atlassian Documentation

3.1 安装字体库

sudo yum -y install fontconfig

拷贝Windows下的字体到服务器Centos中(或者安装Windows字体)

Windows字体一般存放在:C:\Windows\Fonts

可以选择需要的字体,或者打包所有字体上传服务器上

  • Centos创建windows字体目录
sudo mkdir windows-fonts
# 上传解压从Windows拷贝的字体文件
sudo unzip Fonts.zip
  • 搜索目录中所有的字体信息,汇总生成fonts.scale文件
sudo yum -y install ttmkfdir
sudo ttmkfdir
  • 编辑fonts.conf文件,添加windows-fonts目录
sudo vi /etc/fonts/fonts.conf
  • 将刚才创建的字体目录添加到Font directory
  • 刷新字体并验证
sudo fc-cache
sudo fc-list

3.2 Confluence配置

  • 关闭confluence
sudo systemctl stop confluence
  • 设置setenv.sh系统变量 confluence.document.conversion.fontpath

在confluence主目录下的bin文件夹更改setenv.sh,添加windows-fonts目录

CATALINA_OPTS="-Dconfluence.document.conversion.fontpath=/usr/share/fonts/windows-fonts ${CATALINA_OPTS}"
  • 删除临时文件

先将文件移除到其他目录,然后等服务没有问题,再删除移动的目录

<confluence_home>/viewfile/
<confluence_home>/thumbnails/
<confluence_home>/shared-home/dcl-document/
<confluence_home>/shared-home/dcl-document_hd/
<confluence_home>/shared-home/dcl-thumbnail/
  • 启动confluence
sudo systemctl start confluence
  • 验证

本文暂时没有评论,来添加一个吧(●'◡'●)

欢迎 发表评论:

最近发表
标签列表