示例#1
0
        public override void Export()
        {
            var report = ViewState["InvoicesTransactionReport"] as InvoicesTransactionReport;

            if (report != null)
            {
                var document = new ExcelDocument();

                document.WriteTitle(report.Title);

                Hashtable hashtable = new Hashtable();
                hashtable.Add("Customer", "CustomerName");

                ReportGridView.WriteToExcelDocumentWithReplaceField(document, hashtable);

                document.InsertEmptyRow();

                document.AddCell("Funded Total");
                //document.AddCurrencyCell(report.FundedTotal,
                //                                     ReportGridView.Columns["Amount"].Index);

                document.MoveToNextRow();
                document.AddCell("Non Funded Total");
                //document.AddCurrencyCell(report.NonFundedTotal,
                //                                     ReportGridView.Columns["Amount"].Index);

                document.InsertEmptyRow();

                document.AddCell("Based on");
                document.AddCell("Invoice Date");
                document.AddCell("BOM Following");
                document.AddCell("Count");

                document.MoveToNextRow();
                document.AddCell("Mean Debtor Days");
                document.AddNumericCellToCurrentRow(report.MeanDebtorDays);
                document.AddNumericCellToCurrentRow(report.MeanDebtorDaysFromBeginningOfFollowingMonth);
                document.AddNumericCellToCurrentRow(report.NumberOfRecordsPaidFor);

                document.MoveToNextRow();
                document.AddCell("Mean Age of Unpaid ");
                document.AddNumericCellToCurrentRow(report.MeanAgeOfUnpaidRecords);
                document.AddNumericCellToCurrentRow(report.MeanAgeOfUnpaidRecordsFromBeginningOfFollowingMonth);
                document.AddNumericCellToCurrentRow(report.NumberOfRecordsNotPaidFor);

                document.InsertEmptyRow();

                document.AddCell("Date Viewed");
                document.AddCell(report.DateViewed.ToDateTimeString());

                WriteToResponse(document.WriteToStream(), report.ExportFileName);
            }
        }