This question is locked. New answers and comments are not allowed.
I have few question regarding export and custom column headers and follow up here from the following url
my code is somewhat like the following
and also I have exporting method like the following
Now questions;
1. Even though I have access to the stream, I want to write the custom headers after the standard excel header and before the grid data. I am writing the writing data using _exporting method. What is the best place to write the custom column header without writing full XML generation ?
2. As you can see from the code, I am writing both the XML and XLS format, do I have do anything different for each formats?
3. Current export, export all the visible part of the grid with proper column width in excel, but all the columns that are not visible was set to <Column ss:Width="20"> except the last one. I changed the code in _Exporting to the following still did not work
my code is somewhat like the following
if (dialog.ShowDialog() == true) |
{ |
if (dialog.FilterIndex == 1) |
{ |
format = ExportFormat.ExcelML; |
extension = "xml"; |
} |
else |
{ |
format = ExportFormat.Html; |
extension = "xls"; |
} |
using (Stream stream = dialog.OpenFile()) |
{ |
myGrid.Export(stream, |
new GridViewExportOptions() |
{ |
Format = format, |
ShowColumnHeaders = true, |
ShowColumnFooters = false, |
ShowGroupFooters = false |
}); |
} |
} |
void myGrid_Exporting(object sender, GridViewExportEventArgs e) |
{ |
if (e.Value is Telerik.Windows.Controls.GridView.AlignmentContentPresenter) |
{ |
Telerik.Windows.Controls.GridView.AlignmentContentPresenter x = e.Value as Telerik.Windows.Controls.GridView.AlignmentContentPresenter; |
e.Value = x.Content.ToString(); |
} |
else if (e.Element == ExportElement.Cell) |
{ |
if (e.Value != null) |
{ |
if (e.Value.ToString().ToUpper().Equals("TRUE")) |
e.Value = "X"; |
else if (e.Value.ToString().ToUpper().Equals("FALSE")) |
e.Value = ""; |
} |
} |
} |
Now questions;
1. Even though I have access to the stream, I want to write the custom headers after the standard excel header and before the grid data. I am writing the writing data using _exporting method. What is the best place to write the custom column header without writing full XML generation ?
2. As you can see from the code, I am writing both the XML and XLS format, do I have do anything different for each formats?
3. Current export, export all the visible part of the grid with proper column width in excel, but all the columns that are not visible was set to <Column ss:Width="20"> except the last one. I changed the code in _Exporting to the following still did not work
else if (e.Element == ExportElement.HeaderCell) |
{ |
e.Width = 100; |
} |