We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

How to apply custom font for Document

Hi there,

I’m using Aspose Word to export my report. I want to apply my font for my report.
Following is my code to apply font :

var fontSources = new ArrayList(FontSettings.GetFontsSources());
// Add a new folder source which will instruct Aspose.Words to search the following folder for fonts.
var folderFontSource = new FolderFontSource(@"App_Themes\VisionStylesheet\fonts\Bitstream Fonts\Fonts\Original Garamond\OpenType TTF Std\tt0863m_.ttf", true);

// Add the custom folder which contains our fonts to the list of existing font sources.
fontSources.Add(folderFontSource);

// Convert the Arraylist of source back into a primitive array of FontSource objects.
var updatedFontSources = (FontSourceBase[])fontSources.ToArray(typeof(FontSourceBase));

// Apply the new set of font sources to use.
FontSettings.SetFontsSources(updatedFontSources);

But when I view output. This font hasn’t been applied in my report.Please give me advances for this issue.Many thanks for advances,Thanks,Hanh.

Hi Hanh,

Thanks for your inquiry. Please make sure that you’re using latest version of Aspose.Words for .NET i.e. 15.6.0:
https://releases.aspose.com/words/net

In case the problem still remains, please attach 1) your input Word document, 2) output PDF document and 3) Font file here for testing. We will investigate the issue on our end and provide you more information.

Best regards,

Hi you guys,

Thanks for your feedback. Right now, I’m using Aspose Word version: 15.3.2.0. It’s reason to my font cannot apply for my export. This’s right?

Hi Hanh,

Thanks for your inquiry. Well, the problem could be that Aspose.Words could not find required fonts on your machine during rendering. Please refer to the following articles to learn how Fonts work during rendering and if you get notifications of any font substitution during document save.

https://docs.aspose.com/words/net/using-truetype-fonts/
https://docs.aspose.com/words/net/manipulating-and-substitution-truetype-fonts/

Best regards,