You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
47 lines
1.5 KiB
47 lines
1.5 KiB
using System;
|
|
using System.Windows;
|
|
using System.IO;
|
|
using System.Data;
|
|
using CodeReason.Reports;
|
|
using SSWMS.Common;
|
|
|
|
namespace SSWMS.Client
|
|
{
|
|
public partial class ReportWindow : Window
|
|
{
|
|
private DataTable ReportData = null;
|
|
private DataTable ReportHeader = null;
|
|
|
|
public ReportWindow(DataTable dtData, DataTable dtHeader)
|
|
{
|
|
InitializeComponent();
|
|
this.ReportData = dtData;
|
|
this.ReportHeader = dtHeader;
|
|
DocumentContent_Loaded(null, null);
|
|
}
|
|
|
|
private void DocumentContent_Loaded(object sender, RoutedEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
ReportDocument rd = new ReportDocument();
|
|
using (StreamReader reader = new StreamReader(new FileStream(
|
|
AppDomain.CurrentDomain.BaseDirectory + @"@Files\Templates\DynamicReport.xaml", FileMode.Open, FileAccess.Read)))
|
|
{
|
|
rd.XamlData = reader.ReadToEnd();
|
|
reader.Close();
|
|
reader.Dispose();
|
|
}
|
|
rd.ReportTitle = string.Format("导出日期 {0}", StringUtils.GetCurrentDay());
|
|
ReportData data = new ReportData();
|
|
data.DataTables.Add(ReportData);
|
|
data.DataTables.Add(ReportHeader);
|
|
dvDocument.Document = rd.CreateXpsDocument(data).GetFixedDocumentSequence();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
MessageDialog.ShowException(ex);
|
|
}
|
|
}
|
|
}
|
|
}
|