示例#1
0
 private void modelTree_AfterNodeSelect(object sender, AdvTreeNodeEventArgs e)
 {
     if (e.Node.Tag is Maticsoft.Model.SMT_VERMODEL_INFO)
     {
         Maticsoft.Model.SMT_VERMODEL_INFO model = e.Node.Tag as Maticsoft.Model.SMT_VERMODEL_INFO;
         if (model != null)
         {
             _lastSelectModel = model;
             ShowModelReportPreview(_lastSelectModel);
         }
     }
     else if (e.Node.Tag is FileInfo)//示例模板
     {
         try
         {
             var      dt = StaffDataHelper.GetTestReportDataTable();
             FileInfo fi = (FileInfo)e.Node.Tag;
             _report.Clear();
             _report.Load(fi.FullName);
             _report.RegisterData(dt, dt.TableName);
             _report.AutoFillDataSet = true;
             _report.Prepare();
             _report.ShowPrepared();
         }
         catch (Exception ex)
         {
             log.Error("预览示例模板异常:", ex);
             WinInfoHelper.ShowInfoWindow(this, "预览示例模板异常:" + ex.Message);
         }
     }
 }
示例#2
0
 private void ShowModelReportPreview(Maticsoft.Model.SMT_VERMODEL_INFO model)
 {
     try
     {
         _report.Clear();
         byte[]       content = model.VERM_CONTENT;
         MemoryStream ms      = new MemoryStream(content);
         _report.Load(ms);
         ms.Dispose();
         var dt = StaffDataHelper.GetTestReportDataTable();
         _report.RegisterData(dt, dt.TableName);
         _report.AutoFillDataSet = true;
         _report.Prepare();
         _report.ShowPrepared();
     }
     catch (Exception ex)
     {
         WinInfoHelper.ShowInfoWindow(this, "预览模板异常:" + ex.Message);
         log.Error("预览模板异常:", ex);
     }
 }