This is a migrated thread and some comments may be shown as answers.

Unable to Save the Exported Excel file

2 Answers 86 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ghayth Hilal
Top achievements
Rank 1
Ghayth Hilal asked on 22 Feb 2011, 05:06 PM
I'm trying to export the contents of a RadGridView to 'xls'.
Everything works fine on my Development machine (Windows 7 & Visual Studio 2010).

Once I deploy the XAP the the server (IIS 7) the "export to excel" is unable to save the xls file to my HDD.
the "SaveAs" Dialog box opens normally, i type the name of the file in "File name", hit Save....but no file is saved.
if i already have an xls file saved to the HDD and i try to rewrite it it will get deleted.

Please note that I'm unable to save an exported xls or csv file even from the demo on http://demos.telerik.com/silverlight/#GridView/Exporting

below is my XAML & code

<telerik:RadGridView Grid.Row="3"
                                 Name="gvInvalid"
                                 Margin="0,0,0,5"
                                 AutoGenerateColumns="False"
                                 IsReadOnly="True"
                                 ShowGroupPanel="False"
                                 CanUserInsertRows="False"
                                 CanUserDeleteRows="False"
                                 RowIndicatorVisibility="Collapsed">
                <telerik:GridViewDataControl.Columns>
                    <telerik:GridViewDataColumn Header="Cusip/Ticker"
                                                DataMemberBinding="{Binding Cusip__Ticker, Mode=OneTime}" />
                    <telerik:GridViewDataColumn Header="Action"
                                                DataMemberBinding="{Binding Action, Mode=OneTime}" />
                    <telerik:GridViewDataColumn Header="Transaction ID"
                                                DataMemberBinding="{Binding Transaction_ID, Mode=OneTime}" />
                    <telerik:GridViewDataColumn Header="Trade Date"
                                                DataMemberBinding="{Binding Trade_Date, Mode=OneTime}" />
                    <telerik:GridViewDataColumn Header="Settlement Date"
                                                DataMemberBinding="{Binding Settlement_Date, Mode=OneTime}" />
                    <telerik:GridViewDataColumn Header="Original Face Amount"
                                                DataMemberBinding="{Binding Original_Face_Amount, Mode=OneTime}" />
                    <telerik:GridViewDataColumn Header="Face Amount/Shares"
                                                DataMemberBinding="{Binding Face_Amount__Shares, Mode=OneTime}" />
                    <telerik:GridViewDataColumn Header="Principal"
                                                DataMemberBinding="{Binding Principal, Mode=OneTime}" />
                    <telerik:GridViewDataColumn Header="Accrued Interest"
                                                DataMemberBinding="{Binding Accrued_Interest, Mode=OneTime}" />
                    <telerik:GridViewDataColumn Header="Portfolio/Fund"
                                                DataMemberBinding="{Binding Portfolio__Fund, Mode=OneTime}" />
                    <telerik:GridViewDataColumn Header="Custodian"
                                                DataMemberBinding="{Binding Custodian, Mode=OneTime}" />
                    <telerik:GridViewDataColumn Header="Broker"
                                                DataMemberBinding="{Binding Broker, Mode=OneTime}" />
                    <telerik:GridViewDataColumn Header="Amortization Frequency"
                                                DataMemberBinding="{Binding Amortization_Frequency, Mode=OneTime}" />
                    <telerik:GridViewDataColumn Header="Amortization End Date"
                                                DataMemberBinding="{Binding Amortization_End_Date, Mode=OneTime}" />
                    <telerik:GridViewDataColumn Header="Details"
                                                DataMemberBinding="{Binding Note, Mode=OneTime}" />
                </telerik:GridViewDataControl.Columns>
            </telerik:RadGridView>
private void hlbExportInvalidItems_Click(object sender, RoutedEventArgs e)
        {
            Telerik.Windows.Controls.ExportFormat format = Telerik.Windows.Controls.ExportFormat.Html;
            string extension = "xls";
  
            SaveFileDialog dialog = new SaveFileDialog();
            dialog.DefaultExt = extension;
            dialog.Filter = String.Format("{1} files (*.{0})|*.{0}|All files (*.*)|*.*", extension, "Excel");
            dialog.FilterIndex = 1;
  
            if (dialog.ShowDialog() == true)
            {
                using (Stream stream = dialog.OpenFile())
                {
                    Telerik.Windows.Controls.GridViewExportOptions exportOptions = new Telerik.Windows.Controls.GridViewExportOptions();
                    exportOptions.Format = format;
                    exportOptions.ShowColumnFooters = true;
                    exportOptions.ShowColumnHeaders = true;
                    exportOptions.ShowGroupFooters = false;
  
                    gvInvalid.Export(stream, exportOptions);
                }
            }
        }


Any Help is much appreciated

Ghayth

2 Answers, 1 is accepted

Sort by
0
Pavel Pavlov
Telerik team
answered on 25 Feb 2011, 10:16 AM
Hello Ghayth Hilal,

This sounds like a issue related to your local security settings.Unfortunately  I was not able to reproduce such behavior on any of the several machines I have tried with .
I am not sure what may be causing the issue but you should definitely check if any security software installed on your machine is not responsible for this strange issue.

Have you tried this on another machine ?

Greetings,
Pavel Pavlov
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Ghayth Hilal
Top achievements
Rank 1
answered on 29 Mar 2011, 04:52 PM
I fixed this issue by adding our site to the trusted sites on IE.
Tags
GridView
Asked by
Ghayth Hilal
Top achievements
Rank 1
Answers by
Pavel Pavlov
Telerik team
Ghayth Hilal
Top achievements
Rank 1
Share this question
or