本文介绍了如何设置字体大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的代码
我正在生成docx我无法设置字体大小8
受保护 void Page_Load( object sender,EventArgs e)
{
string path = @ C:\ Users \ amalraj.a\Desktop\032114 \ RTF\J50 OHIO 999.64.RTF;
System.Windows.Forms.RichTextBox rtBox = new System.Windows.Forms.RichTextBox();
rtBox.Rtf = System.IO.File.ReadAllText(path); ;
// rtBox.SelectionFont = new Font(Courier New,8,FontStyle.Regular);
// rtBox.SelectionFont = new Font(Courier New,8);
rtBox.Font = new System.Drawing.Font( new System.Drawing。 FontFamily( Courier New), 8 .00F,System.Drawing.FontStyle.Regular); // 此处设置的字体无效
rtBox.SaveFile( @ C:\ Users \ amalraj.a\Desktop\032114 \\ \\ output.\\TestDocument.docx,RichTextBoxStreamType.PlainText);
}
解决方案
This my code
i'm generating docx i can't set set font size 8
protected void Page_Load(object sender, EventArgs e) { string path = @"C:\Users\amalraj.a\Desktop\032114\RTF\J50 OHIO 999.64.RTF"; System.Windows.Forms.RichTextBox rtBox = new System.Windows.Forms.RichTextBox(); rtBox.Rtf = System.IO.File.ReadAllText(path); ; // rtBox.SelectionFont = new Font("Courier New", 8, FontStyle.Regular); //rtBox.SelectionFont = new Font("Courier New", 8); rtBox.Font = new System.Drawing.Font(new System.Drawing.FontFamily("Courier New"), 8.00F, System.Drawing.FontStyle.Regular);//font set here has no effect rtBox.SaveFile(@"C:\Users\amalraj.a\Desktop\032114\output\TestDocument.docx", RichTextBoxStreamType.PlainText); }
解决方案
这篇关于如何设置字体大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!