-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathModule1.xml
83 lines (80 loc) · 2.97 KB
/
Module1.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
REM ***** BASIC *****
Sub create_QR()
epc_name="Max Mustermann"
epc_iban="DE99100200300123456789"
Path=createunoservice("com.sun.star.util.PathSettings")
QRencodeExe=Path.module + "/QREncode/qrencode.exe"
QRCode_X = 18320
QRCode_Y = 24900
qrfile=Path.work + "/qrcode.png"
Doc= thisComponent
if Doc.getDrawpage().count>2 then
Doc.getDrawpage().remove(Doc.getDrawpage().getbyindex(2))
endif
if Doc.getDrawpage().count>2 then
Doc.getDrawpage().remove(Doc.getDrawpage().getbyindex(2))
endif
Suche = Doc.createSearchDescriptor
Suche.SearchRegularExpression = True
Suche.searchString="Rechnung"
Found = Doc.findfirst(Suche)
if IsNull(Found) then exit sub
Suche.searchString="Auftragsnr.+"
Found = Doc.findfirst(Suche)
if IsNull(Found) then
Suche.searchString="Datum.+"
Found = Doc.findfirst(Suche)
if Not IsNull(Found) then epc_rgnr=ltrim(right(Found.string,8))
else
epc_rgnr=ltrim(right(Found.string,8))
endif
Suche.searchString="Rechnungsbetrag.+"
Found = Doc.findfirst(Suche)
if IsNull(Found) then
Suche.searchString="Gesamtpreis.+"
Found = Doc.findfirst(Suche)
if Not IsNull(Found) then epc_betrag="EUR" + ltrim(right(Found.string,9))
else
epc_betrag="EUR" + ltrim(right(Found.string,9))
endif
crlf=Chr(13) + Chr(10)
sMsg = "BCD" + crlf + "002" + crlf + "2" + crlf + "SCT" + crlf + crlf + epc_name + crlf + epc_iban + crlf +_
epc_betrag + crlf + crlf + crlf + epc_rgnr + crlf + "SEPA EPC Code"
if epc_rgnr="" or epc_betrag = "" then exit sub
shell(convertfromurl(QRencodeExe), 6, " -lM -s2 -o """ & convertfromurl(qrfile) & """ """ & sMsg & """", True)
' Grafik einfügen
Dim oSize As New com.sun.star.awt.Size
Dim oPos As New com.sun.star.awt.Point
oGraph = Doc.createInstance("com.sun.star.drawing.GraphicObjectShape")
oGraph.AnchorType = com.sun.star.text.TextContentAnchorType.AT_PAGE
oSize.width=2000
oSize.height=2000
oGraph.setSize(oSize)
oPos.X = QRCode_X
oPos.Y = QRCode_Y
oGraph.setposition(oPos)
oGraph.GraphicURL = qrfile
Doc.getDrawpage().add(oGraph)
' Beschriftung unter QR-Code
oText = Doc.Text
oCursor = oText.createTextCursor()
oFrame = Doc.createInstance("com.sun.star.text.TextFrame")
oframe.setname("QR-Titel")
oFrame.HoriOrient = com.sun.star.text.HoriOrientation.NONE
oFrame.VertOrient = com.sun.star.text.VertOrientation.NONE
oFrame.HoriOrientRelation = com.sun.star.text.RelOrientation.PAGE_FRAME
oFrame.VertOrientRelation = com.sun.star.text.RelOrientation.PAGE_FRAME
oframe.HoriOrientPosition = QRCode_X+130
oFrame.VertOrientPosition = QRCode_Y+1880
oframe.width = 1700
oframe.height = 150
oFrame.AnchorType = com.sun.star.text.TextContentAnchorType.AT_PAGE
oFrame.TextWrap = com.sun.star.text.WrapTextMode.THROUGHT
oFrame.BackColor = &Hcccccc
oText.insertTextContent(oCursor, oFrame, FALSE)
oFrameCursor=oFrame.createTextCursor()
oFrameCursor.CharHeight="7"
oFrameCursor.CharFontName="ArialBlack"
oFrameCursor.paraAdjust = com.sun.star.style.ParagraphAdjust.CENTER
oFrameCursor.String="EPC QR"
end sub