Hello,
I am exporting RadGridView to Excel in Winforms.
In the resulting Excel sheet I need to add an image in the top left cell A1, and some text in cell A4.
I have the code to add the text, but how can I insert an image?
Here is the code from the _ExcelTableCreated event.
// example
void exporter_ExcelTableCreated(object sender, ExcelTableCreatedEventArgs e)
{
SingleStyleElement style = ((ExportToExcelML)sender).AddCustomExcelRow(e.ExcelTableElement, 50, "MY HEADER");
// This is what I need:
// Image img = (Image)Properties.Resources.logo;
// SingleStyleElement style = ((ExportToExcelML)sender).AddCustomExcelRow(e.ExcelTableElement, 50, img);
style.FontStyle.Bold = true;
style.FontStyle.Size = 18;
style.InteriorStyle.Pattern = InteriorPatternType.Solid;
style.AlignmentElement.HorizontalAlignment = HorizontalAlignmentType.Left;
style.AlignmentElement.VerticalAlignment = VerticalAlignmentType.Center;
}
//end of example
Next, I need to turn on the AutoFilter for the Row 2, since my header row now moved down one row. (Ctrl-shift-L shortcut in Excel turns on AutoFilter).
I found the thread about exporting to Excel with autofilter for ASP.NET, but did not locate an example for WinForms.
Thank you in advance!
I am exporting RadGridView to Excel in Winforms.
In the resulting Excel sheet I need to add an image in the top left cell A1, and some text in cell A4.
I have the code to add the text, but how can I insert an image?
Here is the code from the _ExcelTableCreated event.
// example
void exporter_ExcelTableCreated(object sender, ExcelTableCreatedEventArgs e)
{
SingleStyleElement style = ((ExportToExcelML)sender).AddCustomExcelRow(e.ExcelTableElement, 50, "MY HEADER");
// This is what I need:
// Image img = (Image)Properties.Resources.logo;
// SingleStyleElement style = ((ExportToExcelML)sender).AddCustomExcelRow(e.ExcelTableElement, 50, img);
style.FontStyle.Bold = true;
style.FontStyle.Size = 18;
style.InteriorStyle.Pattern = InteriorPatternType.Solid;
style.AlignmentElement.HorizontalAlignment = HorizontalAlignmentType.Left;
style.AlignmentElement.VerticalAlignment = VerticalAlignmentType.Center;
}
//end of example
Next, I need to turn on the AutoFilter for the Row 2, since my header row now moved down one row. (Ctrl-shift-L shortcut in Excel turns on AutoFilter).
I found the thread about exporting to Excel with autofilter for ASP.NET, but did not locate an example for WinForms.
Thank you in advance!