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