Spire.Doc——中英文字体设置


有时我们需要设置中文字体为宋体,西文字体为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;
}


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM