none
export datagridview into excel 2013 RRS feed

  • Question

  • hy this code was good to excel 2007

    but when i upgrade to 2013

    there is an error :

                    //Excel.ApplicationClass xlApp;
                    Excel.Application  xlApp;
    
                    Excel.Workbook xlWorkBook;
    
                    Excel.Worksheet xlWorkSheet;
                    
    
                    object misValue = System.Reflection.Missing.Value;
    
                    SaveFileDialog oDialog = new SaveFileDialog();
    
                    xlApp = new Excel.ApplicationClass();
    
                    xlWorkBook = xlApp.Workbooks.Add(misValue);
    
                    xlWorkSheet = (Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1);
    
                    int i = 0;
    
                    int j = 0;
    
                    int z = 1;
                    //button1.Visible = true;
                    this.Cursor = Cursors.WaitCursor;
    
                    ///////////////////////////////////////////////////////////////////////
                    foreach (DataGridViewColumn c in dvRMS.Columns)
                    {
                        c.SortMode = DataGridViewColumnSortMode.NotSortable;
                        c.Selected = false;
                    }
                    dvRMS.SelectionMode = DataGridViewSelectionMode.FullColumnSelect;
    the row that failes is : 
    xlWorkBook = xlApp.Workbooks.Add(misValue);


    oren t

    • Moved by CoolDadTx Wednesday, February 25, 2015 2:51 PM Office related
    Wednesday, February 25, 2015 1:43 PM

Answers

All replies