I have code to export the grid to pdf, which works fine as long as all the text is well-formed xhtml. In this application, the xhtml is user-supplied, and it's not always well-formed.
I added a try-catch around the export call, but it doesn't seem to catch the exception. When I trace the execution in the debugger, the error doesn't occur until after the code is past the try-catch block.
try
{
switch (exportType)
{
case 1:
grid.ExportSettings.ExportOnlyData = true;
grid.MasterTableView.ExportToExcel();
break;
case 2:
grid.MasterTableView.ExportToPdf();
break;
case 3:
grid.MasterTableView.ExportToWord();
break;
default:
break;
}
}
catch (Exception ex)
{
string errorMessage = "Data export failed. ";
//display message, etc.
}
I added a try-catch around the export call, but it doesn't seem to catch the exception. When I trace the execution in the debugger, the error doesn't occur until after the code is past the try-catch block.
try
{
switch (exportType)
{
case 1:
grid.ExportSettings.ExportOnlyData = true;
grid.MasterTableView.ExportToExcel();
break;
case 2:
grid.MasterTableView.ExportToPdf();
break;
case 3:
grid.MasterTableView.ExportToWord();
break;
default:
break;
}
}
catch (Exception ex)
{
string errorMessage = "Data export failed. ";
//display message, etc.
}