wordDocument.FontSettings.SubstituteFont += (sender, eventArgs) =>
{
// Sets the alternate font when a specified font is not installed in the production environment.
if (eventArgs.OriginalFontName == "Arial")
{
FileStream template = new FileStream(@"Arial.ttf", FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
eventArgs.AlternateFontStream = template;
}
else if (eventArgs.OriginalFontName == "Calibri")
{
FileStream template = new FileStream(@"Calibri.ttf", FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
eventArgs.AlternateFontStream = template;
}
else if(eventArgs.OriginalFontName == "Arial Unicode MS")
{
FileStream template = new FileStream(@"ARIALUNI.TTF", FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
eventArgs.AlternateFontStream = template;
}
}; |