تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
عاوز كود سريع لتصدير البيانات ضخمه الى اكسيل ؟
#1
عاوز كود سريع لتصدير البيانات ضخمه الى اكسيل ؟
الرد }}}
تم الشكر بواسطة:
#2
السلام عليكم ورحمة الله وبركاته
اخي الكريم
تفضل هذا الرابط وفيه شرح استيراد وتصدير من والى الاكسل
لأخينا الفاضل الاستاذ Khodor جزاه الله كل خير
https://www.youtube.com/watch?v=_OV1t1txsGs&t=5s
اعمل الخير وأجرك لا تنتظره فالله خير من إليك يرده
البرمجة ليست مجرد كود بل هي منهج تفكير منطقي لحل المشكلات







الرد }}}
تم الشكر بواسطة: Ashraf Elafify
#3
افضل واسرع طريقة استعمل النسخ واللصق
الرد }}}
تم الشكر بواسطة:
#4
إذا كانت قاعدة البيانات اكسس

افتح قاعدة البيانات و اختر بيانات خارجية ثم تصدير إلى جدول اكسل .
اللهم ارحم من أسس هذا المنتدى (اباليث) و أجعل كل علم نافع تعلمناه في هذا المنتدى أجر له و صدقة تنفعه في قبره
الرد }}}
تم الشكر بواسطة:
#5
كود :
   Public Sub ExportToExcel(ByVal DGV As DataGridView, Optional OpenDialog As Boolean = False, Optional SameColumnsWidth As Boolean = True)
       Dim FlNm As String = ""
       Dim sv As New SaveFileDialog
       sv.FileName = "Excel.xls"
       sv.Filter = "|*.xls"
       If sv.ShowDialog <> DialogResult.OK Then Exit Sub
       FlNm = sv.FileName
       Dim fs As New StreamWriter(FlNm, False)
       With fs
           .WriteLine("<?xml version=""1.0""?>")
           .WriteLine("<?mso-application progid=""Excel.Sheet""?>")
           .WriteLine("<Workbook xmlns=""urn:schemas-microsoft-com:office:spreadsheet"">")
           .WriteLine("  <Styles>")
           .WriteLine("  <Style ss:ID=""hdr"">")
           .WriteLine("  <Alignment ss:Horizontal=""Center""/>")
           .WriteLine("  <Borders>")
           .WriteLine("    <Border ss:Position=""Left"" ss:LineStyle=""Continuous"" ss:Weight=""1""/>")
           .WriteLine("    <Border ss:Position=""Right"" ss:LineStyle=""Continuous"" ss:Weight=""1""/>")
           .WriteLine("    <Border ss:Position=""Top"" ss:LineStyle=""Continuous"" ss:Weight=""1""/>")
           .WriteLine("  </Borders>")
           .WriteLine("  <Font ss:FontName=""Calibri"" ss:Size=""11"" ss:Bold=""1""/>") 'SET FONT
           .WriteLine("  </Style>")
           .WriteLine("  <Style ss:ID=""ksg"">")
           .WriteLine("  <Alignment ss:Vertical=""Bottom""/>")
           .WriteLine("  <Borders/>")
           .WriteLine("  <Font ss:FontName=""Calibri""/>") 'SET FONT
           .WriteLine("  </Style>")
           .WriteLine("  <Style ss:ID=""isi"">")
           .WriteLine("  <Borders>")
           .WriteLine("    <Border ss:Position=""Bottom"" ss:LineStyle=""Continuous"" ss:Weight=""1""/>")
           .WriteLine("    <Border ss:Position=""Left"" ss:LineStyle=""Continuous"" ss:Weight=""1""/>")
           .WriteLine("    <Border ss:Position=""Right"" ss:LineStyle=""Continuous"" ss:Weight=""1""/>")
           .WriteLine("    <Border ss:Position=""Top"" ss:LineStyle=""Continuous"" ss:Weight=""1""/>")
           .WriteLine("  </Borders>")
           .WriteLine("  <Font ss:FontName=""Calibri"" ss:Size=""10""/>")
           .WriteLine("  </Style>")
           .WriteLine("  </Styles>")

           .WriteLine("  <Worksheet ss:Name=""sheet1"">")
           .WriteLine("  <Table>")
           If SameColumnsWidth Then
               For i = 0 To DGV.ColumnCount - 1
                   .WriteLine("  <Column ss:Width=""" & DGV.Columns(i).Width & """/>")
               Next
           End If
           .WriteLine("  <Row ss:StyleID=""ksg"">")
           For i As Integer = 0 To DGV.Columns.Count - 1
               Application.DoEvents()
               .WriteLine("  <Cell ss:StyleID=""hdr"">")
               .WriteLine("    <Data ss:Type=""String"">{0}</Data>", DGV.Columns.Item(i).HeaderText)
               .WriteLine("  </Cell>")
           Next
           .WriteLine("  </Row>")
           Dim DgvCountRow As Integer = 0
           If DGV.AllowUserToAddRows = True Then
               DgvCountRow = DGV.RowCount - 2
           Else
               DgvCountRow = DGV.RowCount - 1
           End If
           For intRow As Integer = 0 To DgvCountRow 'DGV.RowCount - 1
               Application.DoEvents()
               .WriteLine("  <Row ss:StyleID=""ksg"" ss:utoFitHeight =""0"">")
               For intCol As Integer = 0 To DGV.Columns.Count - 1
                   Application.DoEvents()
                   .WriteLine("  <Cell ss:StyleID=""isi"">")
                   .WriteLine("  <Data ss:Type=""String"">{0}</Data>", DGV.Item(intCol, intRow).Value.ToString)
                   .WriteLine("  </Cell>")
               Next
               .WriteLine("  </Row>")
           Next
           .WriteLine("  </Table>")
           .WriteLine("  </Worksheet>")
           .WriteLine("</Workbook>")
           .Close()
           If OpenDialog Then
               Dim msg1
               msg1 = MsgBox("Save complete .. Do you want open file ?", MsgBoxStyle.YesNo + MsgBoxStyle.Question, "Export")
               If msg1 = vbNo Then Exit Sub
               Process.Start(FlNm)
           End If
       End With
   End Sub
الرد }}}
تم الشكر بواسطة:


المواضيع المحتمل أن تكون متشابهة .
الموضوع : الكاتب الردود : المشاهدات : آخر رد
Question [VB.NET] كيف يمكن تحديد البيانات التي اريد ان تظهر في DataGridView1 ؟ Microformt 1 70 18-03-24, 01:37 AM
آخر رد: Kamil
Question [VB.NET] كيف يمكن مسح البيانات في الجدول المجود على الفورم ؟ Microformt 1 109 03-03-24, 08:35 PM
آخر رد: Taha Okla
  اتصال قاعدة البيانات بالسرفر atefkhalf2004 10 318 25-02-24, 09:15 PM
آخر رد: atefkhalf2004
  [مثال] مثال لنسخ وإستعادة قاعدة البيانات ( تحديث) نسخ تلقائي للقاعدة حسب اليوم والساعة جميل علي 81 48,085 10-02-24, 11:26 AM
آخر رد: محمد العموري
  كيفيه عمل حفظ البيانات الخاصة بمتابعة دخول وخروج المستخدمين للبرنامج Saly nor 6 2,615 07-02-24, 05:56 PM
آخر رد: ahmedanwer
  طريقة سهلة للاتصال بقاعدة بيانات SQL مع اضافة ايقونات للتحكم في تدفق البيانات ggtt17121985 0 541 06-11-23, 10:16 AM
آخر رد: ggtt17121985
Star [مشروع] كيفية نقل البيانات الموجودة في الجداول داخل قاعدة البيانات الاولى إلى قاعدة البيانات aliday03 5 1,157 26-03-23, 03:19 PM
آخر رد: sanyor77
  مثال استيراد اى ملف اكسيل وتصدير البيانات الى ملف اكسيل new_programer 3 3,426 07-12-22, 12:19 PM
آخر رد: hoda299
  [VB.NET] اتصال قاعدة البيانات المحلية h2551996 3 1,515 07-12-22, 11:18 AM
آخر رد: h2551996
Rainbow [مثال] بحث لتظهر النتيجه للكلمه المحدد من قاعده البيانات الاكسيس محمد مسافر 0 828 19-10-22, 02:32 AM
آخر رد: محمد مسافر

التنقل السريع :


يقوم بقرائة الموضوع: بالاضافة الى ( 1 ) ضيف كريم