public IPdfReportData CreatePdfReport() { return(new PdfReport().DocumentPreferences(doc => { doc.RunDirection(PdfRunDirection.RightToLeft); doc.Orientation(PageOrientation.Portrait); doc.PageSize(PdfPageSize.A4); doc.DocumentMetadata(new DocumentMetadata { Author = "وحيد", Application = "نرم افزار ", Keywords = "حساب تفصیلی ", Subject = "حساب تفصیلی ", Title = "حساب تفصیلی " }); doc.DiagonalWatermark(new DiagonalWatermark { Text = "Diagonal Watermark\nLine 2\nLine 3", RunDirection = PdfRunDirection.LeftToRight, Font = getWatermarkFont(), FillOpacity = 0.6f, StrokeOpacity = 1 }); doc.Compression(new CompressionSettings { EnableCompression = true, EnableFullCompression = true }); }) .DefaultFonts(fonts => { fonts.Path(System.IO.Path.Combine(AppPath.ApplicationPath, "fonts\\irsans.ttf"), System.IO.Path.Combine(Environment.GetEnvironmentVariable("SystemRoot"), "fonts\\verdana.ttf")); fonts.Size(8); }) .PagesFooter(footer => { footer.DefaultFooter(string.Concat("کاربر : ", "وحيد", " | ", "تاریخ تهیه گزارش : ", PersianDate.ToPersianDateTime(DateTime.Now, "/", true).FixWeakCharacters())); }) .PagesHeader(header => { header.CacheHeader(cache: true); // It's a default setting to improve the performance. header.DefaultHeader(defaultHeader => { defaultHeader.Message("دفتر فرضي"); defaultHeader.ImagePath(System.IO.Path.Combine(AppPath.ApplicationPath, "Images\\01.png")); }); }) .MainTableTemplate(template => { template.CustomTemplate(new GrayTemplate()); }) .MainTablePreferences(table => { table.ColumnsWidthsType(TableColumnWidthType.Relative); table.GroupsPreferences(new GroupsPreferences { GroupType = GroupType.HideGroupingColumns, RepeatHeaderRowPerGroup = true, ShowOneGroupPerPage = true, SpacingBeforeAllGroupsSummary = 5f, NewGroupAvailableSpacingThreshold = 5f }); }) .MainTableDataSource(dataSource => { var rows = new List <VoucherRowPrintViewModel>(); var rnd = new Random(); for (int i = 0; i < 10; i++) { rows.Add(new VoucherRowPrintViewModel { Title = "عنوان " + i, VoucherNumber = i, VoucherDate = DateTime.Now.AddDays(-i), Description = "توضيحات " + i, Debtor = i % 2 == 0? 0: rnd.Next(1, 100), Creditor = i % 2 != 0? 0: rnd.Next(1, 100) }); } dataSource.StronglyTypedList(rows); }) .MainTableColumns(columns => { columns.AddColumn(column => { column.PropertyName <VoucherRowPrintViewModel>(x => x.Title); column.CellsHorizontalAlignment(PdfRpt.Core.Contracts.HorizontalAlignment.Center); column.IsVisible(true); column.IsRowNumber(true); column.Order(0); column.Width(0.7f); column.Group(true, (val1, val2) => { return val1.ToString() == val2.ToString(); }); }); columns.AddColumn(column => { column.PropertyName("rowNumber"); column.CellsHorizontalAlignment(PdfRpt.Core.Contracts.HorizontalAlignment.Center); column.IsVisible(true); column.IsRowNumber(true); column.Order(0); column.Width(0.7f); column.HeaderCell("ردیف"); }); columns.AddColumn(column => { column.PropertyName <VoucherRowPrintViewModel>(x => x.VoucherNumber); column.CellsHorizontalAlignment(PdfRpt.Core.Contracts.HorizontalAlignment.Center); column.IsVisible(true); column.Order(0); column.Width(1); column.HeaderCell("سند"); }); columns.AddColumn(column => { column.PropertyName <VoucherRowPrintViewModel>(x => x.VoucherDate); column.CellsHorizontalAlignment(PdfRpt.Core.Contracts.HorizontalAlignment.Center); column.IsVisible(true); column.Order(1); column.Width(1.5f); column.ColumnItemsTemplate(template => { template.TextBlock(); template.DisplayFormatFormula(obj => { if (obj == null || string.IsNullOrEmpty(obj.ToString())) { return string.Empty; } return PersianDate.ToPersianDateTime((DateTime)obj); }); }); column.HeaderCell("تاریخ"); }); columns.AddColumn(column => { column.PropertyName <VoucherRowPrintViewModel>(x => x.Description); column.CellsHorizontalAlignment(PdfRpt.Core.Contracts.HorizontalAlignment.Left); column.IsVisible(true); column.Order(0); column.Width(4); column.HeaderCell("شرح"); }); columns.AddColumn(column => { column.PropertyName <VoucherRowPrintViewModel>(x => x.Debtor); column.CellsHorizontalAlignment(PdfRpt.Core.Contracts.HorizontalAlignment.Right); column.IsVisible(true); column.Order(2); column.Width(1.5f); column.ColumnItemsTemplate(template => { template.TextBlock(); template.DisplayFormatFormula(obj => obj == null || string.IsNullOrEmpty(obj.ToString()) ? string.Empty : string.Format("{0:n0}", obj)); }); column.AggregateFunction(aggregateFunction => { aggregateFunction.NumericAggregateFunction(AggregateFunction.Sum); aggregateFunction.DisplayFormatFormula(obj => obj == null || string.IsNullOrEmpty(obj.ToString()) ? string.Empty : string.Format("{0:n0}", obj)); }); column.HeaderCell("بدهکار"); }); columns.AddColumn(column => { column.PropertyName <VoucherRowPrintViewModel>(x => x.Creditor); column.CellsHorizontalAlignment(PdfRpt.Core.Contracts.HorizontalAlignment.Right); column.IsVisible(true); column.Order(3); column.Width(1.5f); column.ColumnItemsTemplate(template => { template.TextBlock(); template.DisplayFormatFormula(obj => obj == null || string.IsNullOrEmpty(obj.ToString()) ? string.Empty : string.Format("{0:n0}", obj)); }); column.AggregateFunction(aggregateFunction => { aggregateFunction.NumericAggregateFunction(AggregateFunction.Sum); aggregateFunction.DisplayFormatFormula(obj => obj == null || string.IsNullOrEmpty(obj.ToString()) ? string.Empty : string.Format("{0:n0}", obj)); }); column.HeaderCell("بستانکار"); }); columns.AddColumn(column => { column.PropertyName <VoucherRowPrintViewModel>(x => x.CaclulatedDetection); column.CellsHorizontalAlignment(PdfRpt.Core.Contracts.HorizontalAlignment.Left); column.IsVisible(true); column.Order(4); column.Width(1); column.HeaderCell("تشخیص"); }); columns.AddColumn(column => { column.PropertyName <VoucherRowPrintViewModel>(x => x.CaclulatedRemains); column.CellsHorizontalAlignment(PdfRpt.Core.Contracts.HorizontalAlignment.Right); column.IsVisible(true); column.Order(5); column.Width(1.5f); column.ColumnItemsTemplate(template => { template.TextBlock(); template.DisplayFormatFormula(obj => obj == null || string.IsNullOrEmpty(obj.ToString()) ? string.Empty : string.Format("{0:n0}", obj)); }); column.HeaderCell("مانده"); }); }) .MainTableSummarySettings(summarySettings => { summarySettings.OverallSummarySettings("جمع کل"); summarySettings.PreviousPageSummarySettings("نقل از صفحه قبل"); //summarySettings.AllGroupsSummarySettings("جمع نهايي"); }) .MainTableEvents(events => { events.DataSourceIsEmpty(message: "داده ای جهت نمایش وجود ندارد."); events.CellCreated(args => { args.Cell.BasicProperties.CellPadding = 4f; }); events.MainTableAdded(args => { var taxTable = new PdfGrid(3); // Create a clone of the MainTable's structure taxTable.RunDirection = 3; taxTable.SetWidths(new float[] { 3, 3, 3 }); taxTable.WidthPercentage = 100f; taxTable.SpacingBefore = 10f; taxTable.AddSimpleRow( (data, cellProperties) => { data.Value = "امضاء تنظیم کننده"; cellProperties.ShowBorder = true; cellProperties.PdfFont = args.PdfFont; }, (data, cellProperties) => { data.Value = "امضاء حسابدار"; cellProperties.ShowBorder = true; cellProperties.PdfFont = args.PdfFont; }, (data, cellProperties) => { data.Value = "امضاء مدیرعامل"; cellProperties.ShowBorder = true; cellProperties.PdfFont = args.PdfFont; }); args.PdfDoc.Add(taxTable); }); }) .Export(export => { export.ToExcel("خروجی اکسل"); export.ToCsv("خروجی CSV"); export.ToXml("خروجی XML"); }) .Generate(data => data.AsPdfFile(string.Format("{0}\\Pdf\\RptIListSample-{1}.pdf", AppPath.ApplicationPath, Guid.NewGuid().ToString("N"))))); }
public IPdfReportData CreatePdfReport() { return(new PdfReport().DocumentPreferences(doc => { doc.RunDirection(PdfRunDirection.RightToLeft); doc.Orientation(PageOrientation.Portrait); doc.PageSize(PdfPageSize.A4); doc.DocumentMetadata(new DocumentMetadata { Author = "Vahid", Application = "PdfRpt", Keywords = "Test", Subject = "Test Rpt", Title = "Test" }); doc.Compression(new CompressionSettings { EnableCompression = true, EnableFullCompression = true }); }) .DefaultFonts(fonts => { fonts.Path(System.IO.Path.Combine(AppPath.ApplicationPath, "fonts\\irsans.ttf"), System.IO.Path.Combine(Environment.GetEnvironmentVariable("SystemRoot"), "fonts\\verdana.ttf")); fonts.Size(9); fonts.Color(System.Drawing.Color.Black); }) .PagesFooter(footer => { footer.DefaultFooter("تاريخ: " + PersianDate.ToPersianDateTime(DateTime.Now, "/", true).FixWeakCharacters(), PdfRunDirection.RightToLeft); }) .PagesHeader(header => { header.CacheHeader(cache: true); // It's a default setting to improve the performance. header.DefaultHeader(defaultHeader => { defaultHeader.Message("گزارش جديد ما"); defaultHeader.ImagePath(System.IO.Path.Combine(AppPath.ApplicationPath, "Images\\01.png")); }); }) .MainTableTemplate(template => { template.BasicTemplate(BasicTemplate.ClassicTemplate); }) .MainTablePreferences(table => { table.ColumnsWidthsType(TableColumnWidthType.Relative); }) .MainTableDataSource(dataSource => { var listOfRows = new List <User>(); for (int i = 0; i < 320; i++) { listOfRows.Add(new User { Id = i + 1, LastName = "نام خانوادگي " + i, Name = "نام " + i, Balance = i + 1000, RegisterDate = DateTime.Now.AddDays(-i) }); } dataSource.StronglyTypedList(listOfRows); }) .MainTableSummarySettings(summarySettings => { summarySettings.PreviousPageSummarySettings("منقول از صفحه قبل"); summarySettings.PageSummarySettings("جمع صفحه"); summarySettings.OverallSummarySettings("جمع"); }) .MainTableColumns(columns => { columns.AddColumn(column => { column.PropertyName("rowNo"); column.IsRowNumber(true); column.CellsHorizontalAlignment(HorizontalAlignment.Center); column.IsVisible(true); column.Order(0); column.Width(1); column.HeaderCell("رديف"); }); columns.AddColumn(column => { column.PropertyName <User>(x => x.Id); column.CellsHorizontalAlignment(HorizontalAlignment.Center); column.IsVisible(true); column.Order(1); column.Width(2); column.HeaderCell("شماره"); column.ColumnItemsTemplate(template => { template.TextBlock(); template.DisplayFormatFormula(obj => obj == null || string.IsNullOrEmpty(obj.ToString()) ? string.Empty : long.Parse(obj.ToString()).NumberToText(Language.Persian)); }); }); columns.AddColumn(column => { column.PropertyName <User>(x => x.Name); column.CellsHorizontalAlignment(HorizontalAlignment.Center); column.IsVisible(true); column.Order(2); column.Width(2); column.HeaderCell("نام"); }); columns.AddColumn(column => { column.PropertyName <User>(x => x.LastName); column.CellsHorizontalAlignment(HorizontalAlignment.Center); column.IsVisible(true); column.Order(3); column.Width(2.5f); column.HeaderCell("نام خانوادگي"); }); columns.AddColumn(column => { column.PropertyName <User>(x => x.Balance); column.CellsHorizontalAlignment(HorizontalAlignment.Left); column.IsVisible(true); column.Order(4); column.Width(2); column.HeaderCell("موجودي"); column.ColumnItemsTemplate(template => { template.TextBlock(); template.DisplayFormatFormula(obj => obj == null || string.IsNullOrEmpty(obj.ToString()) ? string.Empty : string.Format("{0:n0}", obj)); }); column.AggregateFunction(aggregateFunction => { aggregateFunction.NumericAggregateFunction(AggregateFunction.Sum); aggregateFunction.DisplayFormatFormula(obj => obj == null || string.IsNullOrEmpty(obj.ToString()) ? string.Empty : string.Format("{0:n0}", obj)); }); }); columns.AddColumn(column => { column.PropertyName <User>(x => x.RegisterDate); column.CellsHorizontalAlignment(HorizontalAlignment.Center); column.IsVisible(true); column.Order(5); column.Width(3); column.HeaderCell("ثبت نام"); column.ColumnItemsTemplate(template => { template.TextBlock(); template.DisplayFormatFormula(obj => obj == null || string.IsNullOrEmpty(obj.ToString()) ? string.Empty : PersianDate.ToPersianDateTime((DateTime)obj)); }); }); }) .MainTableEvents(events => { events.DataSourceIsEmpty(message: "There is no data available to display."); events.MainTableAdded(args => { var data = args.LastOverallAggregateValueOf <User>(y => y.Balance); var msg = "جمع نهايي گزارش : " + data + "، معادل: " + long.Parse(data, NumberStyles.AllowThousands, CultureInfo.InvariantCulture).NumberToText(Language.Persian); var infoTable = new PdfGrid(numColumns: 1) { WidthPercentage = 100 }; infoTable.AddSimpleRow( (cellData, properties) => { cellData.Value = msg; properties.PdfFont = events.PdfFont; properties.RunDirection = PdfRunDirection.RightToLeft; }); args.PdfDoc.Add(infoTable.AddBorderToTable()); }); }) .Export(export => { export.ToExcel(); }) .Generate(data => data.AsPdfFile(string.Format("{0}\\Pdf\\PersianRtlSample-{1}.pdf", AppPath.ApplicationPath, Guid.NewGuid().ToString("N"))))); }
public IPdfReportData CreatePdfReport() { return(new PdfReport().DocumentPreferences(doc => { doc.RunDirection(PdfRunDirection.RightToLeft); doc.Orientation(PageOrientation.Portrait); doc.PageSize(PdfPageSize.A4); doc.DocumentMetadata(new DocumentMetadata { Author = "Vahid", Application = "PdfRpt", Keywords = "Test", Subject = "Test Rpt", Title = "Test" }); doc.Compression(new CompressionSettings { EnableCompression = true, EnableFullCompression = true }); }) .DefaultFonts(fonts => { fonts.Path(System.IO.Path.Combine(AppPath.ApplicationPath, "fonts\\irsans.ttf"), System.IO.Path.Combine(Environment.GetEnvironmentVariable("SystemRoot"), "fonts\\tahoma.ttf")); fonts.Size(9); fonts.Color(System.Drawing.Color.Black); }) .PagesFooter(footer => { footer.XHtmlFooter(rptFooter => { rptFooter.PageFooterProperties(new XFooterBasicProperties { RunDirection = PdfRunDirection.RightToLeft, ShowBorder = true, PdfFont = footer.PdfFont, TotalPagesCountTemplateHeight = 10, TotalPagesCountTemplateWidth = 50, SpacingBeforeTable = 25f }); rptFooter.AddPageFooter(pageFooter => { // <TotalPagesNumber /> is a custom tag. var page = string.Format("صفحه {0} از <TotalPagesNumber />", pageFooter.CurrentPageNumber); var date = PersianDate.ToPersianDateTime(DateTime.Now, "/", true); return string.Format(@"<table style='font-size:9pt;font-family:tahoma;'> <tr> <td width='50%' align='center'>{0}</td> <td width='50%' align='center'>{1}</td> </tr> </table>" , page, date); }); }); }) .PagesHeader(header => { header.CacheHeader(cache: true); // It's a default setting to improve the performance. header.XHtmlHeader(rptHeader => { rptHeader.PageHeaderProperties(new XHeaderBasicProperties { RunDirection = PdfRunDirection.RightToLeft, ShowBorder = true }); rptHeader.AddPageHeader(pageHeader => { var message = "گروه بندي كاركنان بر اساس بخش و سن"; var photo = System.IO.Path.Combine(AppPath.ApplicationPath, "Images\\01.png"); var image = string.Format("<img src='{0}' />", photo); var subNote = @"بدهي پيشين طبق صورتحساب شماره 454 تاريخ 1391/08/05 و كسورات قانوني طبق ماده 33 محاسبه مي گردد(255/12)"; //نكته: در متن فوق براي اينكه تاريخ برعكس نمايش داده نشود نياز است به نحو زير عمل شود subNote = subNote.FixWeakCharacters(); // تنظيم فونت در اينجا فراموش نشود. اين فونت بايد در ابتداي برنامه نيز رجيستر شده باشد يا معرفي به نحو متداول return string.Format(@"<table style='width: 100%;font-size:9pt;font-family:tahoma;'> <tr> <td align='center'>{0}</td> </tr> <tr> <td align='center'><b>{1}</b></td> </tr> <tr> <td align='center'>{2}</td> </tr> </table>" , image, message, subNote); }); rptHeader.GroupHeaderProperties(new XHeaderBasicProperties { RunDirection = PdfRunDirection.RightToLeft, ShowBorder = true, SpacingBeforeTable = 10f }); rptHeader.AddGroupHeader(groupHeader => { var data = groupHeader.NewGroupInfo; var groupName = data.GetSafeStringValueOf <Employee>(x => x.Department); var age = data.GetSafeStringValueOf <Employee>(x => x.Age); //چند نكته: //براي استفاده از چند نوع فونت //در حالت استفاده از اچ تي ام ال //اين فونتها حتما بايد در سيستم ثبت شده باشند مانند قسمت تنظيمات پيش فرض فونتها //به علاوه اولين فونت در اينجا يا حاوي تمام حروف فارسي و انگليسي بايد باشد يا اگر نيست نياز است //صريحا فونت انگليسي مورد نظر اعلام شود //مثلا در اينجا از يك اسپن كمك گرفته شده است return string.Format(@"<table style='width: 100%; font-size:9pt;font-family:tahoma;'> <tr> <td width='75%'>{0}</td> <td width='25%'>بخش(<span style='font-family:tahoma;'>Department</span>):</td> </tr> <tr> <td width='75%'>{1}</td> <td width='25%'>سن:</td> </tr> </table>" , groupName, age); }); }); }) .MainTableTemplate(template => { template.BasicTemplate(BasicTemplate.SilverTemplate); }) .MainTablePreferences(table => { table.ColumnsWidthsType(TableColumnWidthType.Relative); table.GroupsPreferences(new GroupsPreferences { GroupType = GroupType.HideGroupingColumns, RepeatHeaderRowPerGroup = true, ShowOneGroupPerPage = false, SpacingBeforeAllGroupsSummary = 5f, NewGroupAvailableSpacingThreshold = 150 }); }) .MainTableDataSource(dataSource => { var listOfRows = new List <Employee>(); var rnd = new Random(); for (int i = 0; i < 170; i++) { listOfRows.Add( new Employee { Age = rnd.Next(25, 35), Id = i + 1000, Salary = rnd.Next(1000, 4000), Name = "كارمند " + i, Department = "بخش " + rnd.Next(1, 3) }); } listOfRows = listOfRows.OrderBy(x => x.Department).ThenBy(x => x.Age).ToList(); dataSource.StronglyTypedList(listOfRows); }) .MainTableSummarySettings(summarySettings => { summarySettings.PreviousPageSummarySettings("نقل از صفحه قبل"); summarySettings.OverallSummarySettings("جمع گروه"); summarySettings.AllGroupsSummarySettings("جمع كل گروهها"); }) .MainTableColumns(columns => { columns.AddColumn(column => { column.PropertyName("rowNo"); column.IsRowNumber(true); column.CellsHorizontalAlignment(HorizontalAlignment.Center); column.IsVisible(true); column.Order(0); column.Width(20); column.HeaderCell("#"); }); columns.AddColumn(column => { column.PropertyName <Employee>(x => x.Department); column.CellsHorizontalAlignment(HorizontalAlignment.Center); column.Order(1); column.Width(20); column.HeaderCell("بخش"); column.Group( (val1, val2) => { return val1.ToString() == val2.ToString(); }); }); columns.AddColumn(column => { column.PropertyName <Employee>(x => x.Age); column.CellsHorizontalAlignment(HorizontalAlignment.Center); column.Order(2); column.Width(20); column.HeaderCell("سن"); column.Group( (val1, val2) => { return (int)val1 == (int)val2; }); }); columns.AddColumn(column => { column.PropertyName <Employee>(x => x.Id); column.CellsHorizontalAlignment(HorizontalAlignment.Center); column.IsVisible(true); column.Order(3); column.Width(20); column.HeaderCell("شماره"); }); columns.AddColumn(column => { column.PropertyName <Employee>(x => x.Name); column.CellsHorizontalAlignment(HorizontalAlignment.Center); column.IsVisible(true); column.Order(4); column.Width(20); column.HeaderCell("نام"); }); columns.AddColumn(column => { column.PropertyName <Employee>(x => x.Salary); column.CellsHorizontalAlignment(HorizontalAlignment.Center); column.IsVisible(true); column.Order(5); column.Width(20); column.HeaderCell("حقوق"); column.ColumnItemsTemplate(template => { template.TextBlock(); template.DisplayFormatFormula(obj => obj == null || string.IsNullOrEmpty(obj.ToString()) ? string.Empty : string.Format("{0:n0}", obj)); }); column.AggregateFunction(aggregateFunction => { aggregateFunction.NumericAggregateFunction(AggregateFunction.Sum); aggregateFunction.DisplayFormatFormula(obj => obj == null || string.IsNullOrEmpty(obj.ToString()) ? string.Empty : string.Format("{0:n0}", obj)); }); }); }) .MainTableEvents(events => { events.DataSourceIsEmpty(message: "ركوردي جهت نمايش يافت نشد."); }) .Export(export => { export.ToExcel(); }) .Generate(data => data.AsPdfFile(string.Format("{0}\\Pdf\\HtmlHeaderRtlSample-{1}.pdf", AppPath.ApplicationPath, Guid.NewGuid().ToString("N"))))); }
public byte[] CreateInvoiceRtlPdfReport() { return(new PdfReport().DocumentPreferences(doc => { doc.RunDirection(PdfRunDirection.RightToLeft); doc.Orientation(PageOrientation.Portrait); doc.PageSize(PdfPageSize.A5); doc.DocumentMetadata(new DocumentMetadata { Author = "Vahid", Application = "PdfRpt", Keywords = "IList Rpt.", Subject = "Test Rpt", Title = "Test" }); doc.Compression(new CompressionSettings { EnableCompression = true, EnableFullCompression = true }); doc.PrintingPreferences(new PrintingPreferences { ShowPrintDialogAutomatically = false }); }) .DefaultFonts(fonts => { fonts.Path(System.IO.Path.Combine(TestUtils.GetBaseDir(), "fonts", "irsans.ttf"), TestUtils.GetVerdanaFontPath()); fonts.Size(9); fonts.Color(System.Drawing.Color.Black); }) .PagesFooter(footer => { footer.DefaultFooter("تاريخ: " + PersianDate.ToPersianDateTime(DateTime.Now, "/", true).FixWeakCharacters(), PdfRunDirection.RightToLeft); }) .PagesHeader(header => { header.CacheHeader(cache: true); header.InlineHeader(inlineHeader => { inlineHeader.AddPageHeader(data => createHeader(header)); }); }) .MainTableTemplate(template => { template.CustomTemplate(new TransparentTemplate()); }) .MainTablePreferences(table => { table.ColumnsWidthsType(TableColumnWidthType.Relative); table.SpacingAfter(0); }) .MainTableDataSource(dataSource => { dataSource.StronglyTypedList(getDataSourceList()); }) .MainTableColumns(columns => { columns.AddColumn(column => { column.PropertyName("rowNo"); column.IsRowNumber(true); column.CellsHorizontalAlignment(HorizontalAlignment.Center); column.IsVisible(true); column.Order(0); column.Width(1); column.FixedHeight(30); column.HeaderCell("#"); column.AddHeadingCell("فاکتور پرداخت", mergeHeaderCell: true); }); columns.AddColumn(column => { column.PropertyName <InvoicePdfViewModel>(x => x.Status); column.CellsHorizontalAlignment(HorizontalAlignment.Left); column.IsVisible(true); column.Order(1); column.Width(6); column.MinimumHeight(30); column.HeaderCell("اطلاعات"); column.AddHeadingCell(string.Empty, mergeHeaderCell: true); }); columns.AddColumn(column => { column.PropertyName <InvoicePdfViewModel>(x => x.Details); column.CellsHorizontalAlignment(HorizontalAlignment.Center); column.IsVisible(true); column.Order(2); column.Width(5); column.HeaderCell("جزئیات"); column.AddHeadingCell(string.Empty, mergeHeaderCell: true); }); }) .MainTableEvents(events => { events.DataSourceIsEmpty(message: "رکوردی یافت نشد."); events.MainTableAdded(args => { var infoTable = new PdfGrid(numColumns: 1) { WidthPercentage = 100 }; infoTable.AddSimpleRow( (cellData, properties) => { cellData.Value = $"این فاکتور به منزله پرداخت شما به اشکان است."; properties.PdfFont = events.PdfFont; properties.FontColor = BaseColor.Gray; properties.RunDirection = PdfRunDirection.RightToLeft; }); infoTable.AddSimpleRow( (cellData, properties) => { cellData.Value = "هر گونه سوال در مورد خدمات یا محصول را با فروشنده در میان گذارید"; properties.PdfFont = events.PdfFont; properties.FontColor = BaseColor.Gray; properties.RunDirection = PdfRunDirection.RightToLeft; }); args.PdfDoc.Add(infoTable.AddBorderToTable(borderColor: BaseColor.LightGray, spacingBefore: 1f)); }); }) .Export(export => { export.ToExcel(); }) .GenerateAsByteArray()); }