码迷,mamicode.com
首页 > 其他好文 > 详细

Spire.Doc 中英文字体设置

时间:2020-06-08 12:57:31      阅读:212      评论:0      收藏:0      [点我收藏+]

标签:doc   pen   nta   alignment   float   设置   str   fir   char   

有时我们需要设置中文字体为宋体,西文字体为Times New Roman,对于这种情况,在Spire.Doc中可以如下处理

private void AddTextRange(Section section, Paragraph pragraph, string word, float fontSize, bool isBold,  HorizontalAlignment alignType,float suojin)
{
    TextRange textRange = pragraph.AppendText(word);
    textRange.CharacterFormat.FontSize = fontSize;
    textRange.CharacterFormat.Bold = isBold;
    //中文字体
    textRange.CharacterFormat.FontNameFarEast = "宋体";
    //西文字体
    textRange.CharacterFormat.FontNameNonFarEast = "Times New Roman";
    pragraph.Format.HorizontalAlignment = alignType;
    //缩进
    pragraph.Format.FirstLineIndent = suojin;
}

Spire.Doc 中英文字体设置

标签:doc   pen   nta   alignment   float   设置   str   fir   char   

原文地址:https://www.cnblogs.com/liuliang1999/p/13064685.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!