FAQ |
Calendar |
![]() |
|
Programming Share, tanya jawab, saling bantu antar programmer dengan berbagai macam bahasa pemrograman. |
![]() |
|
Thread Tools |
#1
|
|||
|
|||
![]()
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.reflection.CoreReflection") 'Creating a mailmerge object Set objMailMerge = objServiceManager.createInstance("com.sun.star.text.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... Terkait:
|
![]() |
|
|