コード例 #1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            if (doc != null)
            {
                doc.Close();
            }
            if (package != null)
            {
                PackageStore.RemovePackage(PackUri);
                package.Flush();
                package.Close();
            }

            var ms = new MemoryStream();

            package = Package.Open(ms, FileMode.Create, FileAccess.ReadWrite);
            doc     = new XpsDocument(package, CompressionOption.SuperFast, PackUriName);
            PackageStore.AddPackage(PackUri, package);

            var pg = new SampleReport {
                Report = { DataContext = new SampleVM() }
            };
            var report = pg.report;

            //var report = pg.Report;

            report.HeaderHeight = int.Parse(hh.Text);
            report.FooterHeight = int.Parse(fh.Text);

            report.PagePadding = new Thickness(int.Parse(paddingLeft.Text), int.Parse(paddingTop.Text), int.Parse(paddingRight.Text), int.Parse(paddingBottom.Text));

            XpsDocumentWriter xpsWriter = XpsDocument.CreateXpsDocumentWriter(doc);

            xpsWriter.Write(new XpsReportPaginator(report, new Size(96 / 2.54 * 21, 96 / 2.54 * 28.7)));

            dv.Document = doc.GetFixedDocumentSequence();
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: cmenge/RazorTex
        private static SampleReport CreateBogusReport()
        {
            SampleReport report = new SampleReport();
            report.Author = "UTF8-Jürgen";
            report.Title = "RazorTex Sample Report";

            for (int i = 0; i < 10; ++i)
            {
                report.Calculations.Add(DivisionCalculation.Random());
            }

            return report;
        }