Daftar

Mail Merge OpenOffice / LibreOffice & VB6


Programming & Web Coding, web, aplikasi, dan karier developer.

Balas
 
Alat Thread
JagoVB JagoVB sedang offline
#1
Ceriwiser Tanggal Bergabung: Nov 2011 Post: 508 Rep Power: 16 JagoVB mempunyai hidup yang Normal
Default Mail Merge OpenOffice / LibreOffice & VB6
om2... ada yang tau gmana cara meng-otomatis-kan mail merge di LibreOffice/OpenOffice di VB6 ato di Delphi?



cari2 di abang gugel dapet sample kaya gini


Code:

'Creating service manager
Set objServiceManager = CreateObject("com.sun.star.ServiceManager")
'Creating a public object to use reflection for structured properties
Set objCoreReflection = objServiceManager.createInstance("com.sun.star.ref lection.CoreReflection")

'Creating a mailmerge object
Set objMailMerge = objServiceManager.createInstance("com.sun.star.tex t.MailMerge")

'Setting properties
Dim args(0 To 6)
'Url of the source document
Set args(1) = OOoNamedValue("DocumentURL", "file:///d:/temp/cmk.rtf")
'Name of the datasource linked in OO (change it accordingly to your needs)
Set args(0) = OOoNamedValue("DataSourceName", "Bibliography")
'Takes data from 0=tables 1=links 2=queries
Set args(2) = OOoNamedValue("CommandType", 0)
'Name of the datacontainer
Set args(3) = OOoNamedValue("Command", "table1")
'The next fields depend one from each other, this is an example
'Output to 1=printer 2=file
Set args(4) = OOoNamedValue("OutputType", 2)
'Having selected output to file we choose the url of the result files
Set args(5) = OOoNamedValue("OutputURL", "file:///urltoresultfiles/")
'I select the name of the result files
Set args(6) = OOoNamedValue("FileNamePrefix", "auto")
objMailMerge.Execute args()

Function OOoNamedValue(cName, uValue)
Set oPropertyValue = createStruct("com.sun.star.beans.NamedValue")

oPropertyValue.Name = cName
oPropertyValue.Value = uValue

Set OOoNamedValue = oPropertyValue
End Function

Function createStruct(strTypeName)
Set classSize = objCoreReflection.forName(strTypeName)
Dim aStruct
classSize.CreateObject aStruct
Set createStruct = aStruct
End Function

tapi kalo di execute ada error di baris yang dimerahin

Runtime Error 424 - Object Required



LibreOffice SDK udah diinstall







Aslinya sekarang pake Ms Office 2003, trus mau diconvert jadi LO/OOo....



thanks...

</div>
Balas


Aturan Posting
Kamu tidak boleh membuat thread baru
Kamu tidak boleh membalas
Kamu tidak boleh mengirim lampiran
Kamu tidak boleh mengedit post kamu

BB code Hidup
Smilie saat ini Hidup
Kode [IMG] adalah Hidup
Kode HTML adalah Mati


Terkait
Thread Pembuat Thread Forum Balasan Postingan Terakhir
[ask] open office, mail merge problem KernelMad Programming & Web 0 23 Nov 2011 02:14 PM
Program mirip Mail Merge PHPmaster Programming & Web 0 20 Nov 2011 01:03 AM