且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

POI - 导入新的字体到POI

更新时间:2023-12-03 20:30:41

您不能添加字体...
你可以把你的(办公室)文件,就像HTML。字体住文档之外。你刚才设置的字体名称,家庭等。

更新:

不过,已经有人想这样做。使用嵌入的文件,你可以添加字体文件。

链接:

http://apache-poi.1045710.n5.nabble.com/Font-embedding-into-XSLF-td5713937.html

这并不容易。有没有简单的方法来插入嵌入的文件。

How can i import a new font to POI API with extensions ttf & otf , without install these fonts into the environment ?

Is there a jar that i should update it with the path of the new font ?

Normally

You cannot add fonts... You can think your (office) files just like HTML. Font lives outside the document. You just set the font name, family, etc.

Update:

However, someone has already tried to do that. Using embedded files, you could add font files.

Link:

http://apache-poi.1045710.n5.nabble.com/Font-embedding-into-XSLF-td5713937.html

It is far from easy. There's no easy way to insert embedded files.