简体   繁体   中英

How to make string bold in wpf

I used Stimulsoft for printing.so I set a string to a column of datatable .My code for set mystring varieble is :

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

My code for print button is:

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());
        }
    }

And result is :

在此输入图像描述

Now I want to bold findPropertyName(item1.propertyID) .I very googling but I can't find any answer to my question. So How can I fix it?

just I enable html tag in reports designer. so it fixed.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM