错误:文本,基元,图像,CheckBox不是针对stimulsoft的StiStyleComponentType的有效值

时间:2016-08-11 06:58:55

标签: c# wpf stimulsoft

对于报告,我在wpf中使用了stimulsoft。我的Print Button代码是:

try
        {
            DataTable dta = new DataTable();
            DataSet1.dtDataTable dt = new DataSet1.dtDataTable();
            List<KalaClass> list = MetroDataGrid.ItemsSource as List<KalaClass>;

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

                row["id"] = item.KalaID;
                row["name"] = item.KalaName;
                row["tedad"] = item.KalaTedad;
                row["pice"] = item.KalaPrice;
                row["info"] = item.KalaTozihat;
                row["date"] = item.KalaDate;

                dt.Rows.Add(row);
            }

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


            StiReport report = new StiReport();
            report.Load("sReport.mrt");
            report.Dictionary.Clear();
            report.RegData(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());
        }

我得到&#34; Text,Primitive,Image,CheckBox不是StiStyleComponentType的有效值。&#34;错误

  report.Load("sReport.mrt");

我试过但我找不到为什么会收到此错误。我该如何修理它?

1 个答案:

答案 0 :(得分:0)

我的Stimulreport的dll有问题。我删除了它并添加了新版本。所以我修好了。

相关问题