In meindem Video erkläre ich euch die Funktion dieses Makros:
REM ***** BASIC *****
sub Main(sString)rem ----------------------------------------------------------------------Dim oCSV as Object Dim sUrl as String ' Filter festlegen Dim FileProperties(1) As New com.sun.star.beans.PropertyValue FileProperties(0).Name = "FilterName" FileProperties(0).Value ="Text - txt - csv (StarCalc)" FileProperties(1).Name = "FilterOptions" ' FilterOptions FileProperties(1).Value ="59/9,34,UTF-8,1," ' Datei öffnen sUrl = ConvertToUrl (sString) oCSV = _ StarDesktop.loadComponentFromURL( _ sUrl, "_blank", 0, FileProperties()) 'Dokument geöffnet richtig formatiert
rem define variablesdim document as objectdim dispatcher as object
rem get access to the documentdocument = ThisComponent.CurrentController.Framedispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem Set Orientation of Pagedim oStyleFamilies As Objectdim oPageStyles As Objectdim DefPage As Object oStyleFamilies = ThisComponent.StyleFamilies 'ThisComponent refers to the document that called the macro oPageStyles = oStyleFamilies.getByName("PageStyles") 'oPageStyles is a collection of all of the Page styles DefPage = oPageStyles.getByName("Default")'DefPage.IsLandscape = TrueDefPage.Width = 29700 DefPage.Height = 21000
rem ----------------------------------------------------------------------dim args6(0) as new com.sun.star.beans.PropertyValueargs6(0).Name = "ToPoint"args6(0).Value = "$A$1:$G$2"
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args6())
rem ----------------------------------------------------------------------dim args7(0) as new com.sun.star.beans.PropertyValueargs7(0).Name = "HorizontalAlignment"args7(0).Value = com.sun.star.table.CellHoriJustify.LEFT
dispatcher.executeDispatch(document, ".uno:HorizontalAlignment", "", 0, args7())
rem ----------------------------------------------------------------------
Dim c As LongDim z As IntegerDim s As StringDim aktivesBlattDim oCell as ObjectaktivesBlatt = thisComponent.CurrentController.getActiveSheet
z = 11c = 0
For c = 1 To 8 If aktivesBlatt.getCellByPosition(c, 3).String = "" Then If c = 4 Then s = "D" ElseIf c = 5 Then s = "E" ElseIf c = 6 Then s = "F" ElseIf c = 7 Then s = "G" ElseIf c = 8 Then s = "H" Else s = "Nix" End If Exit For End If Next c For z = 4 To 1000 If aktivesBlatt.getCellByPosition(0, z).String = "" Then Exit For End If Next zz = z
rem ----------------------------------------------------------------------dim args1(0) as new com.sun.star.beans.PropertyValueargs1(0).Name = "ToPoint"args1(0).Value = "$A$4:$"+ s + "$"+ z
dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args1())
rem ----------------------------------------------------------------------dim args3(12) as new com.sun.star.beans.PropertyValueargs3(0).Name = "OuterBorder.LeftBorder"args3(0).Value = Array(0,0,2,0,0,2)args3(1).Name = "OuterBorder.LeftDistance"args3(1).Value = 0args3(2).Name = "OuterBorder.RightBorder"args3(2).Value = Array(0,0,2,0,0,2)args3(3).Name = "OuterBorder.RightDistance"args3(3).Value = 0args3(4).Name = "OuterBorder.TopBorder"args3(4).Value = Array(0,0,2,0,0,2)args3(5).Name = "OuterBorder.TopDistance"args3(5).Value = 0args3(6).Name = "OuterBorder.BottomBorder"args3(6).Value = Array(0,0,2,0,0,2)args3(7).Name = "OuterBorder.BottomDistance"args3(7).Value = 0args3(8).Name = "InnerBorder.Horizontal"args3(8).Value = Array(0,0,2,0,0,2)args3(9).Name = "InnerBorder.Vertical"args3(9).Value = Array(0,0,2,0,0,2)args3(10).Name = "InnerBorder.Flags"args3(10).Value = 0args3(11).Name = "InnerBorder.ValidFlags"args3(11).Value = 127args3(12).Name = "InnerBorder.DefaultDistance"args3(12).Value = 0
dispatcher.executeDispatch(document, ".uno:SetBorderStyle", "", 0, args3())
rem ----------------------------------------------------------------dim args4(0) as new com.sun.star.beans.PropertyValueargs4(0).Name = "HorizontalAlignment"args4(0).Value = com.sun.star.table.CellHoriJustify.LEFT
dispatcher.executeDispatch(document, ".uno:HorizontalAlignment", "", 0, args4())rem ----------------------------------------------------------------
document = ThisComponent.CurrentController.Frame dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
'dim sString As String 'sString= "C:/Users/danny/Desktop/Projekte/test" rem ---------------------------------------------------------------------- dim args5(1) as new com.sun.star.beans.PropertyValue args5(0).Name = "URL" args5(0).Value = ConvertToUrl(sString) &".pdf" args5(1).Name = "FilterName" args5(1).Value = "calc_pdf_Export"
dispatcher.executeDispatch(document, ".uno:ExportDirectToPDF", "", 0, args5()) '################################################################################# 'Schließen oDoc = thisComponent 'odoc.store odoc.close(true)
end sub