thx info nya pak, ijin coba ya pak
--- On Mon, 12/22/08, Hotdin Gurning <[email protected]> wrote:
From: Hotdin Gurning <[email protected]>
Subject: [indopb] Re: export report to excel
To: [email protected]
Date: Monday, December 22, 2008, 2:53 AM
Kalo ga mau repot dengan DW2Xls.pbd or DW2XLS.PBL, coba yang ini:
f_excel(datawindow idw)
int li_rtn
string xlsname,nama, ls_alamat
//CEK, SIAPA TAHU AJA DATAWINDOW KOSONG
if idw.rowcount( ) <= 0 then
messagebox(' Export Excel','Tidak ditemukan data yang akan di export!')
return
end if
//TEMPAT PENYIMPANAN FILE EXCEL
li_rtn = GetFileSaveName( "Select File", &
xlsname, nama, "", &
"Excel 97-2003 Workbook(*.xls) ,*.*,")
//CONVERT DATAWINDOW KE FORMAT HTML DULU
IF idw.SaveAs( xlsname+'.xls' , HTMLTable!, TRUE ) = -1 THEN
MessageBox(" Warning", "Tidak memungkinkan untuk export data!",
Exclamation! )
RETURN ;
END IF ;
// CONVERT HTML FILE KE EXCEL NATIVE FORMAT
OLEObject Excel ;
Excel = CREATE OLEObject ;
IF Excel.ConnectToObje ct(xlsname+ '.xls' ) = 0 THEN
Excel.Application. DisplayAlerts = FALSE ;
Excel.Application. Workbooks( 1 ).Parent.Windows(
excel.Application. workbooks( 1 ).Name ).Visible = TRUE ;
Excel.Application. Workbooks( 1 ).SaveAs(xlsname+ '.xls', 39 ) ;
Excel.Application. Workbooks( 1 ).close() ;
messagebox(' Export Excel','Data Berhasil Diexport ke Excel!')
run("C:\WINDOWS\ explorer. exe "+xlsname+'. xls')
END IF ;
DESTROY excel
____________ _________ _________ _________ _________ _________ _
Atau Mas ingin export ke word?, Boleeh.. cuma beda dikit kok.
f_word(datawindow idw)
//Edited By : Hotdin Gurning Rabu,16 Dec '08 03.30 WIB
integer li_ret
int li_rtn
//Directory Penyimpanan File Word
string docname,nama, ls_alamat
li_rtn = GetFileSaveName( "Select File", &
docname, nama, "", &
"Microsoft Word Document(*.doc) ,*.*,")
//Atur properties tabel dengan script html
dw_1.Object. DataWindow. HTMLTable. BORDER='1'
dw_1.Object. DataWindow. HTMLTable. cellpadding= '0'
dw_1.Object. DataWindow. HTMLTable. cellspacing= '0'
//Cek dulu, Export ke word dibatalkan atau tidak
if li_rtn<>0 then
dw_1.SaveAs( docname+'.doc' , htmltable! , TRUE )
else
messagebox(' Export word','Export word Dibatalkan oleh user!')
end if
//Convert ke html tabel
if dw_1.SaveAs( docname+'.doc' , htmltable! , TRUE ) = 1 then
OLEObject word ;
//create ole
word = CREATE OLEObject ;
//connect ke WINWORD.EXE
word.ConnectToNewOb ject( 'word.application. 8' )
IF word.ConnectToObjec t( docname ) = 0 THEN
word.Application. Visible = TRUE
END IF ;
//Buka file yang telah diexport
run("C:\WINDOWS\ explorer. exe "+docname+'. doc')
// Tutup WINWORD.EXE
word.DisconnectObje ct()
DESTROY word
else
messagebox(' Error','Tidak dapat melakukan report ke file
word!',exclamation! )
end if
Regards,
Hotdin Gurning
____________ _________ _________ _________ _________ _________ _
> --- In ind...@yahoogroups. com, Doni Setya Wijaya <doni_setya@ > wrote:
> >
> > Dear All,
> >
> > Boleh donk sharing, yang punya pengalaman eksport file report dari
> datawindow ke excel sama dengan tampilan di screen, termasuk Header,
> judul report,warna dan atributnya.
> >
> > Terima kasih atas sharingnya
> >
> > Regards,
> > PB fan's member
> >
>