Hello there
I am using the following code to export a RadGridView into ExcelML format.
This code is generating a nice ExcelML format. But here is my issue.
Some of the columns inside my RadGridView contain illegal XML characters. These get exported "as they are" into the xml which in turn makes the Excel parser to fail in execution.
This could be fixed if I could set the value of the column in export to something like
<![CDATA[ value of my column ]]>
In this way if the value of my column contains characters such as < > or & those wont be parsed by EXCEL.
Is there a way of adding these specs to the column to export?
Thanks!
I am using the following code to export a RadGridView into ExcelML format.
private
void
Test(
object
sender, System.Windows.RoutedEventArgs e)
{
ExportFormat format = ExportFormat.ExcelML;
string
extension =
"xml"
;
SaveFileDialog dialog =
new
SaveFileDialog();
dialog.DefaultExt = extension;
dialog.Filter =
string
.Format(
"{1} files (*.{0})|*.{0}|All files (*.*)|*.*"
, extension,
"ExcelML"
);
dialog.FilterIndex = 1;
if
(dialog.ShowDialog() ==
true
)
{
using
(Stream stream = dialog.OpenFile())
{
GridViewExportOptions exportOptions =
new
GridViewExportOptions();
exportOptions.Format = format;
exportOptions.ShowColumnHeaders =
true
;
exportOptions.Culture =
new
System.Globalization.CultureInfo(
"en-US"
);
exportOptions.Encoding = System.Text.Encoding.UTF8;
Grid.Export(stream, exportOptions);
}
}
}
This code is generating a nice ExcelML format. But here is my issue.
Some of the columns inside my RadGridView contain illegal XML characters. These get exported "as they are" into the xml which in turn makes the Excel parser to fail in execution.
This could be fixed if I could set the value of the column in export to something like
<![CDATA[ value of my column ]]>
In this way if the value of my column contains characters such as < > or & those wont be parsed by EXCEL.
Is there a way of adding these specs to the column to export?
Thanks!