Ceriwis  

Go Back   Ceriwis > HOBI > Komputer & Teknologi > Programming

Programming Share, tanya jawab, saling bantu antar programmer dengan berbagai macam bahasa pemrograman.

Reply
 
Thread Tools
  #1  
Old 20th November 2011
Linuxmania Linuxmania is offline
Ceriwiser
 
Join Date: Nov 2011
Posts: 392
Rep Power: 14
Linuxmania mempunyai hidup yang Normal
Default [Nanya gan] tentang Excel...

gan ane mau tanya dong... ane kan ada buat coding export dari vb.net ke excel.. nah cara ngelebarin kolom "F" di excel pake coding di vb.net gmn y gan..? ane dah coba2 coding di vb.net, kolom di excel nya tetep aja ga jd lebar... mohon pencerahannya gan... ni ada screenshoot nya...







nih coding ane gan :




Code:

Private Sub ButtonX7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonX7.Click
Dim xlapp As excel.Application
Dim xlworksheet As New excel.Worksheet
Dim xlworkbook As excel.Workbook
Dim misValue As Object = System.Reflection.Missing.Value

Dim i As Integer
xlapp = New excel.ApplicationClass
xlworkbook = xlapp.Workbooks.Add(misValue)
xlworksheet = xlworkbook.Sheets("sheet1")
xlworksheet.Cells(2, 6 + 1) = "Data Mahasiswa"

'xlworksheet.Cells.Width(1, 6) = 77.4

For i = 0 To ds.Siswa.Rows.Count - 1
For j = 0 To ds.Siswa.Columns.Count - 1

xlworksheet.Cells(i + 5, j + 4) = ds.Siswa.Rows(i)(j)
xlworksheet.Cells(4, 4) = ds.Siswa.Columns(0).Caption
xlworksheet.Cells(4, 5) = ds.Siswa.Columns(1).Caption
xlworksheet.Cells(4, 6) = ds.Siswa.Columns(2).Caption
xlworksheet.Cells(4, 7) = ds.Siswa.Columns(3).Caption
xlworksheet.Cells(4, 8) = ds.Siswa.Columns(4).Caption
xlworksheet.Cells(4, 9) = ds.Siswa.Columns(5).Caption
xlworksheet.Cells(4, 10) = ds.Siswa.Columns(6).Caption
xlworksheet.Cells(4, 11) = ds.Siswa.Columns(7).Caption

Next
Next

xlworksheet.SaveAs("D:\hasil export\coba\coba.xlsx")
'xlworkbook.OpenLinks("D:\hasil export\lihat.xlsx")
xlapp.Quit()

trus gan.. klo mau nampilin excel nya otomatis gmn y gan? jd pas kita klik tombol print di form vb.net, nah microsoft excel nya langsung kebuka... thx gan sblm nya...



Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


 


All times are GMT +7. The time now is 04:21 AM.


no new posts