I need to export the first page of a Writer document as jpeg, via Basic macro, in the same way I can do it by using the menu File>Export and choosing "jpeg" as filetype.
I found this code, but doesn't works with Writer:
Code: Select all
Sub ExportJPG
Dim Props(1) as New com.sun.star.beans.PropertyValue
oSM = GetProcessServiceManager
ExportSrv = oSM.createInstance("com.sun.star.drawing.GraphicExportFilter")
oDPages = oTextDoc.getDrawPage()
oPage = oDPages.getByIndex(1)
ExportSrv.setSourceDocument(oTextDoc)
Props(0).Name = "MediaType"
Props(0).Value = "image/jpeg"
Props(1).Name = "URL"
Props(1).Value = "file:///C:/Exported.jpg"
ExportSrv.filter(Props)
End Sub
Thanks
Luke