Membuat margecell Excel dengan foxpro

lanjutan dari convert DBF to Excel nih, langsung aja nih yaa

😀

create Cursor curCompany (Company C(20),code c(4), satu L, dua L, tiga L, empat L)

INSERT INTO curcompany(company,code,satu,dua,tiga,empat);
values("A","01",.t.,.f.,.t.,.f.)
INSERT INTO curcompany(company,code,satu,dua,tiga,empat);
values("B","02",.f.,.f.,.t.,.f.)
INSERT INTO curcompany(company,code,satu,dua,tiga,empat);
values("C","03",.t.,.f.,.f.,.f.)
INSERT INTO curcompany(company,code,satu,dua,tiga,empat);
values("D","04",.t.,.t.,.t.,.f.)
INSERT INTO curcompany(company,code,satu,dua,tiga,empat);
values("E","05",.t.,.f.,.t.,.t.)
* Excel: HorizontalAlignment
* 2 = Left
* 3 = Center
* 4 = Right

Local oExcel, oSheet
oExcel = Createobject([Excel.Application])
oExcel.Visible = .T.
oExcel.Workbooks.Add()

oSheet = oExcel.ActiveSheet

lnRow = 0
Select curCompany
Go Top
Do While Not Eof()
lnRow = lnRow + 1
If lnRow = 1
oSheet.Cells(lnRow,1).Value = []
oSheet.Cells(3,1).Value = [NAMA BULAN]
oSheet.Cells(3,1).HorizontalAlignment = 3
oSheet.Range("A3","B3").Merge
oSheet.Cells(3,3).Value = [TANDA TERIMA REKAP HARIAN USER]
oSheet.Cells(3,3).HorizontalAlignment = 3
oSheet.Range("C3","J3").Merge
oSheet.Cells(4,3).Value = [TANGGAL]
oSheet.Cells(4,3).HorizontalAlignment = 3
oSheet.Range("C4","J4").Merge
oSheet.Cells(4,1).Value = [NAMA CABANG]
oSheet.Range("A4","A5").Merge
oSheet.Cells(4,2).Value = [KODE BARANG]
oSheet.Range("B4","B5").Merge
lnRow = 5
lnCol = 3
oSheet.Cells(lnRow,lnCol).Value = [SATU]
oSheet.Cells(lnRow,lnCol).Font.Bold = .T.

*oSheet.Cells(lnRow,lnCol).HorizontalAlignment = xlCenter
oSheet.Cells(lnRow,lnCol).HorizontalAlignment = 3

lnCol = lnCol + 1
oSheet.Cells(lnRow,lnCol).Value = [DUA]
oSheet.Cells(lnRow,lnCol).Font.Bold = .T.
*oSheet.Cells(lnRow,lnCol).HorizontalAlignment = xlCenter
oSheet.Cells(lnRow,lnCol).HorizontalAlignment = 3

lnCol = lnCol + 1
oSheet.Cells(lnRow,lnCol).Value = [TIGA]
oSheet.Cells(lnRow,lnCol).Font.Bold = .T.
*oSheet.Cells(lnRow,lnCol).HorizontalAlignment = xlCenter
oSheet.Cells(lnRow,lnCol).HorizontalAlignment = 3

lnCol = lnCol + 1
oSheet.Cells(lnRow,lnCol).Value = [EMPAT]
oSheet.Cells(lnRow,lnCol).Font.Bold = .T.
*oSheet.Cells(lnRow,lnCol).HorizontalAlignment = xlCenter
oSheet.Cells(lnRow,lnCol).HorizontalAlignment = 3

lnRow = 6
lnBeginRange = lnRow
Endif
oSheet.Cells(lnRow,1).Value = curCompany.Company
oSheet.Cells(lnRow,2).Value = curCompany.CODE
oSheet.Cells(lnRow,3).Value = curCompany.SATU
oSheet.Cells(lnRow,4).Value = curCompany.dua
oSheet.Cells(lnRow,5).Value = curCompany.tiga
oSheet.Cells(lnRow,6).Value = curCompany.empat
*osheet.Range("a3:j10").BorderAround(6)
oSheet.Range("A3:j10").Borders(1).Weight = 3
oSheet.Range("A3:j10").Borders(2).Weight = 3
oSheet.Range("A3:j10").Borders(3).Weight = 3
oSheet.Range("A3:j10").Borders(4).Weight = 3
Skip
Enddo

hasil lihat gambar


OK selamat belajar, moga sukses yaa terus berkarya🙂

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

%d blogger menyukai ini: