using System; using System.IO; using System.Collections.Generic; using System.Text; using System.Windows; using System.Windows.Controls; using System.Windows.Data; using System.Windows.Documents; using System.Windows.Input; using System.Windows.Media; using System.Windows.Media.Imaging; using System.Windows.Navigation; using System.Windows.Shapes; using Stimulsoft.Base.Drawing; using Stimulsoft.Report; using Stimulsoft.Report.Components; using Microsoft.Win32; namespace RuntimeBuildReport { /// /// Interaction logic for Window1.xaml /// public partial class Window1 : Window { private string path = string.Empty; private System.Data.DataSet dataSet1 = new System.Data.DataSet(); private string schemaFile; private string xmlFile; public Window1() { Stimulsoft.Report.Wpf.StiThemesHelper.LoadTheme(this); InitializeComponent(); //Microsoft.Win32.RegistryKey key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\\Stimulsoft\\Stimulsoft Reports"); //bool is64Bit = IntPtr.Size == 8; //if (is64Bit) key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\\Wow6432Node\\Stimulsoft\\Stimulsoft Reports"); //path = (string)key.GetValue("Bin") + "\\Data\\"; //if (File.Exists(path + "Demo.xsd")) dataSet1.ReadXmlSchema(path + "Demo.xsd"); //else MessageBox.Show("File \"Demo.xsd\" not found"); //if (File.Exists(path + "Demo.xsd")) dataSet1.ReadXml(path + "Demo.xml"); //else MessageBox.Show("File \"Demo.xml\" not found"); dataSet1.DataSetName = "Demo"; } private void Button_Click(object sender, RoutedEventArgs e) { schemaFile = "C:\\temp\\birt\\TestFooBar.xsd"; xmlFile = "C:\\temp\\birt\\TestBar.xml"; dataSet1.ReadXmlSchema(schemaFile); dataSet1.ReadXml(xmlFile); //Add data to datastore StiReport report = new StiReport(); report.Load("C:\\temp\\birt\\TestFooBar.mrt"); report.RegData(dataSet1); //Fill dictionary //report.Dictionary.Synchronize(); //report.Dictionary.Load(xmlFile); //report.ExportDocument(StiExportFormat.Word2007, "c:\\temp\\fuddel.docx"); report.ShowWithWpf(); } private void selectXML_Click(object sender, RoutedEventArgs e) { OpenFileDialog dialog = new OpenFileDialog(); dialog.InitialDirectory = "c:\\temp\\birt"; dialog.Filter = "XML-Datei |*.xml|Alle Dateien |*.*"; dialog.CheckFileExists = true; if (dialog.ShowDialog() == true) { xmlFile = dialog.FileName; labelXML.Content = xmlFile; } } private void selectXSD_Click(object sender, RoutedEventArgs e) { OpenFileDialog dialog = new OpenFileDialog(); dialog.InitialDirectory = "c:\\temp\\birt"; dialog.Filter = "XSD-Datei |*.xsd|Alle Dateien |*.*"; dialog.CheckFileExists = true; if (dialog.ShowDialog() == true) { schemaFile = dialog.FileName; labelXSD.Content = schemaFile; } } } }