[英]Set crystal report textobject bold at runtime using C#
我正在使用C#代碼更新Crystal報表中的文本對象,
ReportDocument rptDoc = new ReportDocument();
rptDoc.Load(Environment.CurrentDirectory + @"\Test.rpt");
TextObject txtTest = (TextObject)rptDoc.ReportDefinition.ReportObjects["txtTest"];
txtTest.Text = "Test";
現在,我想將“ txtTest”文本對象中的文本加粗。
我正在尋找這樣的東西,
txtTest.Font.Bold = true;
但不幸的是,它是只讀的。
最后,我找到了解決方案。
System.Drawing.Font font1 = new System.Drawing.Font("Arial", 12, FontStyle.Bold);
txtTest.ApplyFont(font1);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.