Copyriht © 2011 PcDr SysDba
  Excel'e Veri Aktarma
 

Microsoft Excel'e Veri Aktarma...!



private void barButtonItem11_ItemClick(object sender, ItemClickEventArgs e)
        {
        

 Microsoft.Office.Interop.Excel.Application objWord = new Microsoft.Office.Interop.Excel.Application();
            objWord.Visible = true;
            Microsoft.Office.Interop.Excel.Workbook objbook = objWord.Workbooks.Add(System.Reflection.Missing.Value);
            Microsoft.Office.Interop.Excel.Worksheet objsheet = (Microsoft.Office.Interop.Excel.Worksheet)objbook.Worksheets.get_Item(1);
            Microsoft.Office.Interop.Excel.Range objRange;

            objRange = objsheet.get_Range("A1", System.Reflection.Missing.Value);
            objRange.set_Value(System.Reflection.Missing.Value, label1.Text);
            objRange = objsheet.get_Range("A2", System.Reflection.Missing.Value);
            objRange.set_Value(System.Reflection.Missing.Value, textEdit1.Text);


            objRange = objsheet.get_Range("B1", System.Reflection.Missing.Value);
            objRange.set_Value(System.Reflection.Missing.Value, label2.Text);
            objRange = objsheet.get_Range("B2", System.Reflection.Missing.Value);
            objRange.set_Value(System.Reflection.Missing.Value, imageComboBoxEdit1.Text);

            objRange = objsheet.get_Range("C1", System.Reflection.Missing.Value);
            objRange.set_Value(System.Reflection.Missing.Value, label3.Text);
            objRange = objsheet.get_Range("C2", System.Reflection.Missing.Value);
            objRange.set_Value(System.Reflection.Missing.Value, ımageComboBoxEdit2.Text);

            objRange = objsheet.get_Range("D1", System.Reflection.Missing.Value);
            objRange.set_Value(System.Reflection.Missing.Value, label4.Text);
            objRange = objsheet.get_Range("D2", System.Reflection.Missing.Value);
            objRange.set_Value(System.Reflection.Missing.Value, ımageComboBoxEdit3.Text);

            objRange = objsheet.get_Range("E1", System.Reflection.Missing.Value);
            objRange.set_Value(System.Reflection.Missing.Value, label6.Text);
            objRange = objsheet.get_Range("E2", System.Reflection.Missing.Value);
            objRange.set_Value(System.Reflection.Missing.Value, dateTimePicker1.Text);


            objRange = objsheet.get_Range("F1", System.Reflection.Missing.Value);
            objRange.set_Value(System.Reflection.Missing.Value, label5.Text);
            objRange = objsheet.get_Range("F2", System.Reflection.Missing.Value);
            objRange.set_Value(System.Reflection.Missing.Value, textEdit2.Text);

        }
 



Not
Mutlaka "References" Bölümüne
"Microsoft.Office.Interop.Excel"
Ve Uzay Metoduna
"Using office = Microsoft.Office.Interop.Excel;"
Eklemeyi Unutmayınız....
Yoksa Komutlar Çalışmaz

 
 
  Bugün 13 ziyaretçi (14 klik) kişi burdaydı!  
 
Bu web sitesi ücretsiz olarak Bedava-Sitem.com ile oluşturulmuştur. Siz de kendi web sitenizi kurmak ister misiniz?
Ücretsiz kaydol