This question is locked. New answers and comments are not allowed.

Jerry Kurata
Top achievements
Rank 1
Jerry Kurata
asked on 06 Jul 2010, 06:37 PM
Hi,
When I export a grid to ExcelM and then attempt to open the .xlm file before I close the silverlight application I get the message "xxx.xml is locked for editing by 'another user'. Open 'Read-Only' or clik ' Notify' to open read-only and receive notification when the document is no longer in use.".
Any ideas?
4 Answers, 1 is accepted
0
Hello,
Vlad
the Telerik team
Can you post the code used to save this file? Is it the same as in our demo?
Regards,Vlad
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0

Jerry Kurata
Top achievements
Rank 1
answered on 07 Jul 2010, 05:05 PM
My code is the same as the sample with grid passed in and modifications to hide/show a column and show only selected rows. My code is:
public void ExportRadGridView(RadGridView SourceGrid, string ExportType,
bool ShowCompound, string CompoundUniqueName, bool SelectedOnly)
{
string extension = "";
ExportFormat format = ExportFormat.Html;
int CompoundColIndex = -1;
// Hide the compound column if we are not showing it.
if (!ShowCompound)
{
for (int i = 0; i < SourceGrid.Columns.Count; i++)
{
if (SourceGrid.Columns[i].UniqueName == CompoundUniqueName)
{
CompoundColIndex = i;
break;
}
}
if (CompoundColIndex >= 0)
SourceGrid.Columns[CompoundColIndex].IsVisible = false;
}
switch (ExportType.ToUpper())
{
//case "Excel": extension = "xls";
// format = ExportFormat.Html;
// break;
case "EXCEL":
extension = "xml";
format = ExportFormat.ExcelML;
break;
case "WORD":
extension = "doc";
format = ExportFormat.Html;
break;
case "CSV":
extension = "csv";
format = ExportFormat.Csv;
break;
}
SaveFileDialog dialog = new SaveFileDialog();
dialog.DefaultExt = extension;
dialog.Filter = String.Format("{1} files (*.{0})|*.{0}|All files (*.*)|*.*", extension, ExportType);
dialog.FilterIndex = 1;
if (dialog.ShowDialog() == true)
{
Stream OutputStream = dialog.OpenFile();
GridViewExportOptions exportOptions = new GridViewExportOptions();
exportOptions.Format = format;
exportOptions.ShowColumnFooters = true;
exportOptions.ShowColumnHeaders = true;
exportOptions.ShowGroupFooters = true;
if (SelectedOnly)
exportOptions.Items = SourceGrid.SelectedItems;
SourceGrid.Export(OutputStream, exportOptions);
// Re show the compound column if we hid it for the export
if (!ShowCompound && (CompoundColIndex >= 0))
SourceGrid.Columns[CompoundColIndex].IsVisible = true;
}
}
0
Hello,
Vlad
the Telerik team
You've missed the using() block.
Greetings,Vlad
the Telerik team
Do you want to have your say when we set our development plans?
Do you want to know when a feature you care about is added or when a bug fixed?
Explore the
Telerik Public Issue Tracking
system and vote to affect the priority of the items
0

Jerry Kurata
Top achievements
Rank 1
answered on 08 Jul 2010, 03:59 PM
Thanks Vlad. I don't know how I missed that!