PHPExcel:自定义字体?

发布于 2025-01-02 09:37:29 字数 116 浏览 4 评论 0原文

有没有办法将字体嵌入到 xls 中并与 PHPExcel 一起使用?

我想要自定义字体,因为我想在 Excel 中使用条形码字体。 我尝试嵌入条形码图像,但打印时出现随机点,并且条形码扫描仪无法读取它。

Is there a way to embed a font to the xls and use it with PHPExcel?

I want custom font because I want to use barcode font in the excel.
I tried to embed a barcode image but random dot appears when printing and the barcode scanner cannot read it.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

若沐 2025-01-09 09:37:29

没有。 Excel 依赖于打开 Excel 文档的客户端 PC 上存在的字体范围。如果字体不存在,它将回退到该客户端 PC 上存在的字体系列的成员。如果 xls 文件中引用的字体在客户端 PC 上不存在该字体系列的成员,则根本无法呈现该字体。这是标准的 MS Excel 行为,并非特定于 PHPExcel 生成的文件。

我建议的唯一选择是生成条形码的图像文件,并将该图像嵌入到 xls 文件中。

There isn't. Excel relies on the range of fonts that exist on the client PC where the Excel document is opened. Where a font doesn't exist, it will fall back to members of the font family that exist on that client PC. In the case of a font referenced in an xls file where no member of that font family exists on the client PC, it simply cannot be rendered. This is standard MS Excel behaviour, not specific to PHPExcel-generated files.

The only alternative I can suggest is generating an image file of the barcode, and embedding that image in the xls file.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文