当前位置: 首页>>代码示例>>C#>>正文


C# Report.SaveToFile方法代码示例

本文整理汇总了C#中Report.SaveToFile方法的典型用法代码示例。如果您正苦于以下问题:C# Report.SaveToFile方法的具体用法?C# Report.SaveToFile怎么用?C# Report.SaveToFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Report的用法示例。


在下文中一共展示了Report.SaveToFile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

        static void Main(string[] args)
        {
            var frame = new ReportFrame(
                new ReportFrameData()
                {
                    Header1 = "Contacts list sample",
                    Header2 = "Created by André Pena's SmartRecords",
                    FooterLeft1 = "Created by SmartRecords",
                    FooterLeft2 = "http://www.smartrecords.net",
                    FooterRight1 = "",
                    FooterRight2 = ""
                });

            // creates a new report
            var report = new Report(frame);
            foreach (var patient in ContactsDataSource.GetContacts())
            {
                // creates a data-context for each contact inside the report
                // inside the data-context, it's possible to add titles, cards and grids
                using (var patientContext = report.AddDataContext(patient))
                {
                    patientContext.AddTitle(ReportTitleSize.H1, m => "Contact: " + m.FirstName + " " + m.LastName);
                    var card = patientContext.AddCard();
                    card.AddField(m => m.FirstName);
                    card.AddField(m => m.LastName);
                    card.AddField(m => m.DateOfBirth);
                    card.AddField(m => m.Email, true);
                    card.AddField(m => m.Notes);

                    patientContext.AddTitle(ReportTitleSize.H2, m => "Address");
                    var addressCard = patientContext.AddCard(m => m.Address);
                    addressCard.AddField(m => m.AddressLine1, true);
                    addressCard.AddField(m => m.AddressLine2, true);
                    addressCard.AddField(m => m.City);
                    addressCard.AddField(m => m.State);
                    addressCard.AddField(m => m.Country);
                    addressCard.AddField(m => m.Zip);

                    patientContext.AddTitle(ReportTitleSize.H2, m => "Appointments");
                    var appointmentCard = patientContext.AddGrid(m => m.Appointments);
                    appointmentCard.AddColumn(m => m.With);
                    appointmentCard.AddColumn(m => m.Date);
                }
            }
            report.SaveToFile("document.pdf");
            Process.Start("document.pdf");
        }
开发者ID:vathuluri,项目名称:SmartRecords,代码行数:47,代码来源:Program.cs


注:本文中的Report.SaveToFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。