示例#1
0
        private void btnPrint_Click(object sender, RoutedEventArgs e)
        {
            string xslName = m_sFilePath + @"\xsl\SerchResultDetail.xsl";

            if (File.Exists(xslName))
            {
                if (this.dgDetailRecords.Items.Count == 0)
                {
                    System.Windows.MessageBox.Show(@"列表中无可用数据");
                    return;
                }
                string htmlName = dsrsrc.PrintDoc(xslName, m_sFilePath, 1);
                if (htmlName != "")
                {
                    PrintPreview pr = new PrintPreview(htmlName);
                    pr.Show();
                }
                else
                {
                    System.Windows.MessageBox.Show("找不到生成的HTML文件。");
                    return;
                }
            }
            else
            {
                System.Windows.MessageBox.Show("找不到格式文件。");
                return;
            }
        }
示例#2
0
        private void BtnPreview_Click(object sender, RoutedEventArgs e)
        {
            string xslName = m_sFilePath + @"\xsl\SerchResult.xsl";

            if (File.Exists(xslName))
            {
                if (this.dataGridSisSerch.Items.Count == 0)
                {
                    System.Windows.MessageBox.Show(@"列表中无可用数据");
                    return;
                }
                string htmlName = dsrsrc.PrintDoc(xslName, m_sFilePath, 0);
                if (htmlName != "")
                {
                    PrintPreview pr = new PrintPreview(htmlName);
                    pr.Show();
                }
                else
                {
                    System.Windows.MessageBox.Show("找不到生成的HTML文件。");
                    return;
                }
            }
            else
            {
                System.Windows.MessageBox.Show("找不到格式文件。");
                return;
            }


            //报表实现方法:先导出Excel然后读取显示
            //根据模板生成word文件
            //ViewWord vw = new ViewWord(dsrsrc);
            //vw.Show();
            //wordView vw = new wordView();
            //vw.ShowDialog();
            //rePortForm rpf = new rePortForm(dsrsrc, "TraProcessInfoDataTable", Environment.CurrentDirectory.ToString() + @"\Template\Report1.rdlc");
            //rpf.ShowDialog();
            ////  报表打印
            //string reportPath = Environment.CurrentDirectory.ToString() + @"\Template\XLJGCX.rpt";
            //viewReport pw = new viewReport();
            //pw.Data_Binding(0, reportPath, "TraProcessInfoDataTable", dsrsrc.trainMangeDataSet);
            //pw.Show();
        }