This question is locked. New answers and comments are not allowed.
Hello,
I am trying to use the grids Export Async functionality and here are 4 questions / obstacles I have.
Please feel free to ignore question #1 as it is a Microsoft question.
*********1***********
I am opening a windows SaveFileDialog from a click event and I am setting a DefaultFileName.
1-1 Setting a default file name introduces a modal windows popup that says Title:"File Download - Security Warning Content " Content:"Do you want to save *** file?" I know this is a microsoft thing but was wondering if anyone knows how to directly go to the SaveFileDialog and have DefaultFileName at the same time.
1-2 I tried this with a command bound to the Button and I get a "Dialog must be opened from a user initiated request". Are commands not used initiated? Or am I missing soemething?
I am using ExportAsync function of the Grid and I noticed that this function is significantly slower than Export (which uses the UI thread)
- Is this a known issue? Any recomendations?
//Slow
SampleRadGridView.ExportAsync(sameExactStream,
new GridViewExportOptions()
{
Format = ExportFormat.Html,
ShowColumnHeaders = true,
ShowColumnFooters = true,
ShowGroupFooters = true,
}, true);
**********************************************
VS
**********************************************
//Fast
SampleRadGridView.Export(sameExactStream,
new GridViewExportOptions()
{
Format = ExportFormat.ExcelML,
ShowColumnHeaders = true,
ShowColumnFooters = true,
ShowGroupFooters = true
});
********3************
As recomended in the documentation to avoid an excel security warning upon opening an exported file, I am setting my GridViewExportOption.Format to EXCELML and setting my extension to xml.
Although this gets rid of the security warning, even minutes after export is done opening this file in EXCEL causes a "This file is open by another application {Notify, Read only, cancel} options."
Do you have an example that uses this format and an xml extension? All the examples on the demo site use other formats and opening their export causes an excel security warning.
*****4*********
I would like to export a Grid with Hierarchical data (Nested Grids).
The child Grid is a DataTemplate and I am able to access it and export it using examples you have. Examples are using ToHtml and wrapping the output with html Table and styling it.
This is not going to work with ExportML format, so I have to use the ToExcelML function on the nested Grid; problem is getting it nested .... please see a snipet below:
var grid = sender as RadGridView;
if (grid != null && grid.HasHierarchy)
{
DataTemplate template = null;
template = grid.HierarchyChildTemplate;
if (template != null)
{
var nestedGrid = template.LoadContent() as RadGridView;
if (nestedGrid != null)
{
nestedGrid.DataContext = e.Context;
var nestedExport = nestedGrid.ToExcelML(); // Is there a specialized function for nested grids?
e.Writer.Write(nestedExport);
}
}
}
Thanks for your help!
I am trying to use the grids Export Async functionality and here are 4 questions / obstacles I have.
Please feel free to ignore question #1 as it is a Microsoft question.
*********1***********
I am opening a windows SaveFileDialog from a click event and I am setting a DefaultFileName.
1-1 Setting a default file name introduces a modal windows popup that says Title:"File Download - Security Warning Content " Content:"Do you want to save *** file?" I know this is a microsoft thing but was wondering if anyone knows how to directly go to the SaveFileDialog and have DefaultFileName at the same time.
1-2 I tried this with a command bound to the Button and I get a "Dialog must be opened from a user initiated request". Are commands not used initiated? Or am I missing soemething?
var dialog = new SaveFileDialog()
{
DefaultExt = "xml",
Filter = "Excel Workbook (.xml)|*.xml",
DefaultFileName = "sample" + DateTime.Now.ToString("_MM_dd_yyyy_HH_mm_ss") // without this annoying popup doesn't exist but this is useful :)
};
if (dialog.ShowDialog() == true)
{
//do cool stuff here
}
********2************I am using ExportAsync function of the Grid and I noticed that this function is significantly slower than Export (which uses the UI thread)
- Is this a known issue? Any recomendations?
//Slow
SampleRadGridView.ExportAsync(sameExactStream,
new GridViewExportOptions()
{
Format = ExportFormat.Html,
ShowColumnHeaders = true,
ShowColumnFooters = true,
ShowGroupFooters = true,
}, true);
**********************************************
VS
**********************************************
//Fast
SampleRadGridView.Export(sameExactStream,
new GridViewExportOptions()
{
Format = ExportFormat.ExcelML,
ShowColumnHeaders = true,
ShowColumnFooters = true,
ShowGroupFooters = true
});
********3************
As recomended in the documentation to avoid an excel security warning upon opening an exported file, I am setting my GridViewExportOption.Format to EXCELML and setting my extension to xml.
Although this gets rid of the security warning, even minutes after export is done opening this file in EXCEL causes a "This file is open by another application {Notify, Read only, cancel} options."
Do you have an example that uses this format and an xml extension? All the examples on the demo site use other formats and opening their export causes an excel security warning.
*****4*********
I would like to export a Grid with Hierarchical data (Nested Grids).
The child Grid is a DataTemplate and I am able to access it and export it using examples you have. Examples are using ToHtml and wrapping the output with html Table and styling it.
This is not going to work with ExportML format, so I have to use the ToExcelML function on the nested Grid; problem is getting it nested .... please see a snipet below:
var grid = sender as RadGridView;
if (grid != null && grid.HasHierarchy)
{
DataTemplate template = null;
template = grid.HierarchyChildTemplate;
if (template != null)
{
var nestedGrid = template.LoadContent() as RadGridView;
if (nestedGrid != null)
{
nestedGrid.DataContext = e.Context;
var nestedExport = nestedGrid.ToExcelML(); // Is there a specialized function for nested grids?
e.Writer.Write(nestedExport);
}
}
}
Thanks for your help!