以编程方式在.docx文件中嵌入字体系列 [英] programmatically embedding Font Family in .docx file
问题描述
我正在尝试在docx文件中插入字体系列(不是系统字体).
我正在使用openxml-sdk实现此功能.
我能以某种方式从特定的docx文件中获取字体信息.但是无法将字体系列嵌入文档中吗?
是否可以使用代码将字体嵌入到docx文件中?
I am trying to insert the font family (not system fonts) in the docx file.
I am using openxml-sdk to achieve this functionality.
Somehow I am able to get the font information from a particular docx file. But not able to embed the font family in the document
Is it possible to embed the font in a docx file using code?
推荐答案
是的,对于docx来说是微不足道的.
Yes, it trivial for docx.
MS Word具有该[ http://www.howtogeek.com/howto/microsoft-office/embed-true-type-fonts-in-word-and-powerpoint-2007-documents/] .
MS Word have check-box for that [http://www.howtogeek.com/howto/microsoft-office/embed-true-type-fonts-in-word-and-powerpoint-2007-documents/].
要以编程方式执行此操作,请研究具有和不具有字体的第一个简单DOCX,并比较差异.
To do this programmatically, investigate first simple DOCX with and without font, and compare the differences.
仅供参考:docx只是.zip文件,只需将两个文件的扩展名更改为.zip并比较它们的内容.如果执行了此操作,则将看到带有字体文件的其他"font"目录,以及一个引用了它们的XML.
FYI: docx it is just .zip file, just change extension of both files to .zip and compare they content. If you done this - than you will see additional "font" directory with font files, plus one XML which have references to them.
我对代码的要求不高,但是开发一个将很简单.
I don't have please of code, but developing one will be simple.
请注意,并非所有字体许可证都允许嵌入,例如 http://www.word-2010.com/embedding-fonts-in-word-2010/,但这是一个单独的问题.
Note, not all font licenses allow embedding, like http://www.word-2010.com/embedding-fonts-in-word-2010/, but this is separate question.
这篇关于以编程方式在.docx文件中嵌入字体系列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!