programaticaly embedding Font Family in .docx file

2019-05-26 15:06发布

问题:

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?

回答1:

Yes, it trivial for docx.

MS Word have check-box for that [http://www.howtogeek.com/howto/microsoft-office/embed-true-type-fonts-in-word-and-powerpoint-2007-documents/].

To do this programmatically, investigate first simple DOCX with and without font, and compare the differences.

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.

Note, not all font licenses allow embedding, like http://www.word-2010.com/embedding-fonts-in-word-2010/, but this is separate question.