找回密码
 立即注册

QQ登录

只需一步,快速开始

James.Lv 讲师达人认证 悬赏达人认证 活字格认证 Wyn认证
超级版主   /  发表于:2020-6-30 17:40  /   查看:2322  /  回复:0
本帖最后由 Eden.Sun 于 2023-1-5 19:08 编辑

问题描述:
Wyn Enterprise支持Docker方式部署,通过Docker方式部署之后,报表查看时发现报表单元格不能根据内容的长度去自动适应行高,问题现象如下:
image.png284902648.png
问题定位:
这个问题是由于docker方式部署,docker容器内部缺少相应的中文字体导致。

解决方法:
向docker容器内部安装相应的中文字体,安装方法有多种,此处提供一种方法。
下载附件的微软雅黑字体,放到Yahei文件夹中,文件夹中的字体文件,应是如下三个文件:
  1. msyh.ttc
  2. msyhbd.ttc
  3. msyhl.ttc
复制代码
然后将该文件夹上传到宿主机上,比如上传到宿主机的 /usr/share/fonts/路径,然后再通过命令将该文件夹上传到docker容器内部的/usr/share/fonts/路径(这儿上传的docker容器名称为wyn)
  1. docker cp   /usr/share/fonts/Yahei/   wyn:/usr/share/fonts/
复制代码
接着通过如下命令进入容器内部
  1. docker exec -it wyn /bin/bash
复制代码
image.png649656982.png

进入到容器内部之后,执行如下命令安装字体,如下图提示表示安装成功。
  1. fc-cache -fv
复制代码
image.png757273559.png

注意:执行该步命令时有可能会显示如下错误提示:
image.png957340087.png
该提示表示容器内部没有该命令,安装改命令(此步骤需要网络):

  1. apt-get install fontconfig
复制代码
由于默认的软件更新源是国外的,在国内使用速度很慢,可以更换成国内的源(比如:阿里源,清华,中科大,网易等等),此处示例为阿里源
  1. deb http://mirrors.aliyun.com/debian/ stretch main non-free contrib
  2. deb-src http://mirrors.aliyun.com/debian/ stretch main non-free contrib
  3. deb http://mirrors.aliyun.com/debian-security stretch/updates main
  4. deb-src http://mirrors.aliyun.com/debian-security stretch/updates main
  5. deb http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib
  6. deb-src http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib
  7. deb http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib
  8. deb-src http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib
复制代码
更换方法为,在容器内部:
  1. cat  > /etc/apt/sources.list << EOF
  2. > deb http://mirrors.aliyun.com/debian/ stretch main non-free contrib
  3. > deb-src http://mirrors.aliyun.com/debian/ stretch main non-free contrib
  4. > deb http://mirrors.aliyun.com/debian-security stretch/updates main
  5. > deb-src http://mirrors.aliyun.com/debian-security stretch/updates main
  6. > deb http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib
  7. > deb-src http://mirrors.aliyun.com/debian/ stretch-updates main non-free contrib
  8. > deb http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib
  9. > deb-src http://mirrors.aliyun.com/debian/ stretch-backports main non-free contrib
  10. > EOF
复制代码
更换完成后执行如下命令:
  1. apt-get update
复制代码

最后字体安装成功后,重新启动docker容器
  1. docker restart wyn
复制代码
再次预览报表即可看到单元格可以根据内容的长度去自动适应行高
image.png103930357.png



msyhl.ttc

11.58 MB, 下载次数: 52

msyhbd.ttc

16.05 MB, 下载次数: 52

msyh.ttc

18.74 MB, 下载次数: 50

0 个回复

您需要登录后才可以回帖 登录 | 立即注册
返回顶部