/// <summary> /// Occurs when the PdfExportingOptions.CellExporting event occurs. /// </summary> /// <param name="sender">The PdfExportingOptions object.</param> /// <param name="e">The DataGridCellPdfExportingEventArgs that contains the event data.</param> private void OnCustomizedCellExporting(object sender, DataGridCellPdfExportingEventArgs e) { if (e.ColumnName == "Discount") { e.PdfGridCell.Style.BackgroundBrush = PdfBrushes.Violet; } }
private void options_CellExporting(object sender, DataGridCellPdfExportingEventArgs e) { if (e.CellType == ExportCellType.StackedHeaderCell) { if (e.CellValue.ToString() == "Order Details") { var cellStyle = new PdfGridCellStyle(); cellStyle.BackgroundBrush = PdfBrushes.DarkCyan; cellStyle.TextBrush = PdfBrushes.White; e.PdfGridCell.Style = cellStyle; } else if (e.CellValue.ToString() == "Customer Details") { var cellStyle = new PdfGridCellStyle(); cellStyle.BackgroundBrush = PdfBrushes.LightCyan; e.PdfGridCell.Style = cellStyle; } else if (e.CellValue.ToString() == "City Details") { var cellStyle = new PdfGridCellStyle(); cellStyle.BackgroundBrush = PdfBrushes.DarkGray; cellStyle.TextBrush = PdfBrushes.White; e.PdfGridCell.Style = cellStyle; } } }
private void ExportOptions_CellExporting(object sender, DataGridCellPdfExportingEventArgs e) { if ((e.ColumnName == "OrderID" || e.ColumnName == "EmployeeID" || e.ColumnName == "OrderDate" || e.ColumnName == "Freight") && e.CellType == ExportCellType.RecordCell) { e.PdfGridCell.Style = cellstyle; } e.PdfGridCell.Style.Borders.All = new PdfPen(PdfBrushes.Black, 1.0f); }
/// <summary> /// Occurs when the PdfExportingOptions.CellExporting event occurs. /// </summary> /// <param name="sender">The PdfExportingOptions object.</param> /// <param name="e">The DataGridCellPdfExportingEventArgs that contains the event data.</param> private void OnSelectedItemsCellExporting(object sender, DataGridCellPdfExportingEventArgs e) { PdfFont font = new PdfStandardFont(PdfFontFamily.Helvetica, 12); e.PdfGridCell.Style.Font = font; }