簡體   English   中英

如何在wpf中使字符串變粗

[英]How to make string bold in wpf

我使用Stimulsoft進行打印。所以我將一個字符串設置為一個數據表列。我的set mystring varieble的代碼是:

foreach(var item1 in listpp)
{
    KalaClass.KalaTozihat += item1.value + " :  " + findPropertyName(item1.propertyID) + "\r";
}

我的打印按鈕代碼是:

private void btnPrint_Click(object sender, RoutedEventArgs e)
    {
        try
        {
            DataTable dta = new DataTable();
            DataSet1.DtKalaDataTable dt = new DataSet1.DtKalaDataTable();
            List<KalaClass> list = MetroDataGrid.ItemsSource as List<KalaClass>;

            foreach (var item in list)
            {
                var row = dt.NewRow();

                row["id"] = item.KalaID.ToString();
                row["name"] = item.KalaName;
                row["tedad"] = item.KalaTedad.ToString();
                row["price"] = item.KalaPrice;
                row["info"] = item.KalaTozihat;
                row["date"] = item.KalaDate;
                row["cat"] = item.catName;
                row["productCode"] = item.proCode;
                row["productCode"] = item.proCode;
                row["pic"] = item.Pics;
                dt.Rows.Add(row);
            }

            DataSet ds = new DataSet();
            ds.Tables.Add(dt);


            StiReport report = new StiReport();
            report.Load("Report1.mrt");
            report.Dictionary.Clear();
            report.RegData("DtKala", ds);
            report.Dictionary.Synchronize();
            DateTime today = Convert.ToDateTime(DateTime.Today.ToShortDateString());

            (report.GetComponentByName("txtDate") as StiText).Text = convertDate.toShamsi(today);
            //(report.GetComponentByName("txtName") as StiText).Text = comboBox.SelectionBoxItem.ToString();
            //(report.GetComponentByName("Text1") as StiText).Text = txtid.Text;


            report.Show();
        }

        catch (Exception ex)
        {
            MessageBox.Show(ex.Message.ToString());
        }
    }

結果是:

在此輸入圖像描述

現在我想加粗findPropertyName(item1.propertyID) 。我非常谷歌搜索,但我找不到任何問題的答案。 那么我該如何解決呢?

我只在報表設計器中啟用html標簽。 所以它修好了。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM