dass der gleiche code mehr als einmal verwendet wird liegt an copy und paste und zu wenig Zeit später zu optimieren. Aber immerhin ein guter Hinweis. Im gesamten code sind sicherlich noch viele dinge zu optimieren...
Code: Alles auswählen
REM ***** BASIC *****
Option explicit
global g as Integer
rem dim mydlg as object
Sub Datum_eintragen
Dim oDataBaseContext as Object
Dim forms as Object
Dim oDoc as Object
Dim oForm as Object
Dim oControl1 as Object
Dim oControl2 as Object
Dim oControl3 as Object
Dim oSchalttext as String
Dim I as Integer
Dim von as String
Dim bis as String
oDataBaseContext = createUNOService("com.sun.star.sdb.DatabaseContext")
forms = oDatabaseContext.getByName("bwforum").DatabaseDocument.getFormDocuments()
'forms = oDatabaseContext.getByName("bwforum").DatabaseDocument.getFormDocuments()
oForm = forms.getByName("Programmerstellung").getcomponent().DrawPage.Forms.getByName("Programm")
oControl1 = oForm.getbyName("DateField1")
oControl2 = oForm.getbyName("DateField2")
oControl3 = oForm.getbyName("PushButton1")
von = "20"+right(oControl1.text,2)+"-"+mid(oControl1.text,4,2)+"-"+Left(oControl1.text,2)
bis = "20"+right(oControl2.text,2)+"-"+mid(oControl2.text,4,2)+"-"+Left(oControl2.text,2)
oSchalttext = "Programm vom"+chr(13)+oControl1.text+chr(13)+"bis"
'von = oControl1.text
'bis = oControl2.text
if CDate(oControl2.Text)> CDate(oControl1.Text) Then
oSchalttext = oSchalttext+chr(13)+oControl2.text+chr(13)+"erstellen!"
oForm.Filter = "( `DATUM` >= {D'"+von+"'} AND `DATUM` <= {D'"+bis+"'})"
oForm.applyFilter = 1
'xRay oForm
oForm.reload
end if
oControl3.Label = oSchalttext
End Sub
Sub Abfrageerstellen as Object
Dim oDataBaseContext as Object
Dim forms as Object
Dim oForm as Object
Dim oControl1 as Object
Dim oControl2 as Object
Dim oMyDoc as Object
Dim von as String
Dim bis as String
Dim Url as String
Dim Dummy()
Dim Cursor As Object
Dim I as Double
Dim CellCursor as Object
Dim Table as Object
dim oLinie as new com.sun.star.table.BorderLine
dim oRahmen as new com.sun.star.table.TableBorder
Dim Spalte()
Dim Cell As Object
Dim oLib as Object
Dim oLibDlg as Object
Dim oDialog as Object
Dim oProgressBarModel as Object
Dim oProgressBar as Object
oDataBaseContext = createUNOService("com.sun.star.sdb.DatabaseContext")
'forms = oDatabaseContext.getByName("bwforum").DatabaseDocument.getFormDocuments()
forms = oDatabaseContext.getByName("bwforum").DatabaseDocument.getFormDocuments()
oForm = forms.getByName("Programmerstellung").getcomponent().DrawPage.Forms.getByName("Programm")
oControl1 = oForm.getbyName("DateField1")
oControl2 = oForm.getbyName("DateField2")
von = "20"+right(oControl1.text,2)+"-"+mid(oControl1.text,4,2)+"-"+Left(oControl1.text,2)
bis = "20"+right(oControl2.text,2)+"-"+mid(oControl2.text,4,2)+"-"+Left(oControl2.text,2)
Url = ConvertToUrl("C:\Docs\Vorlage_Programm.ott")
'Url = ConvertToUrl("g:\bwforum\Docs\Vorlage_Programm.ott")
oMyDoc = StarDesktop.loadComponentFromURL(Url, "_blank", 0, Dummy())
'msgBox "Bitte ok clicken und warten bis das Dokument erstellt ist!"
DialogLibraries.loadLibrary("Standard")
oLib = DialogLibraries.getByName("Standard")
oLibDlg = oLib.getByName("Fortschritt")
oDialog = CreateUnoDialog(oLibDlg)
oDialog.setVisible( True )
oProgressBarModel = oDialog.Model.ProgressBar1
oProgressBarModel.ProgressValue = 3
oProgressBarModel.ProgressValueMax = 100
oProgressBar = oDialog.getControl("ProgressBar1")
oProgressBar.setVisible( True )
'mache hier was mit Deinem Code
'aktualisiere periodisch die Fortschrittsanzeige:
Cursor = oMyDoc.Text.createTextCursor()
Cursor.gotoEnd(false)
Cursor.String = "KATHOLISCHE ERWACHSENENBILDUNG"+chr(10)+"FORUM BAD WÖRISHOFEN E. V."+chr(13)
Cursor.gotoEnd(false)
Cursor.ParaStyleName = "Standard"
Cursor.CharWeight = 200
Cursor.String = "Anschrift:"+chr(13)
Cursor.gotoEnd(false)
Cursor.CharWeight = 100
Cursor.String = "Obere Mühlstraße 9 b, 86825 Bad Wörishofen"+chr(10)+"Telefon: (0 82 47) 33 47 63"+chr(10)+ _
"Fax: (0 82 47) 33 48 19"+chr(10)+"E-Mail: bw-forum.de"+chr(10)+"Homepage: http://www.bw-forum.de"+_
chr(10)+chr(10)+"1. Vorsitzender: Dr. Bernhard Ledermann Tel. 15 41 (privat)"+chr(10)+_
"E-Mail: dr.bernhard.ledermann@bw-forum.de"+chr(10)+"Geschäftsführung: Irma Dzalbs Tel. 23 89 (privat)"+_
chr(10)+"E-Mail: irma.dzalbs@bw-forum.de"+chr(10)+chr(13)
Cursor.gotoEnd(false)
Cursor.CharWeight = 200
Cursor.String = "Geschäftszeiten:"+chr(13)
Cursor.gotoEnd(false)
Cursor.CharWeight = 100
Cursor.String = "Montag und Mittwoch von 9 Uhr bis 12 Uhr"+chr(10)+"und nach Vereinbarung!"+chr(13)
Cursor.gotoEnd(false)
Cursor.ParaStyleName = "Überschrift 2"
Cursor.String = "Ständige Veranstaltungen"+chr(13)
Staendige ("11",von,bis)
oProgressBarModel.ProgressValue = 10 'x ist neuer Wert
Staendige1213 ("12",von,bis)
oProgressBarModel.ProgressValue = 20 'x ist neuer Wert
'Staendige1213 ("13",von,bis)
oProgressBarModel.ProgressValue = 30 'x ist neuer Wert
normalfoku ("10",von,bis)
Cursor.gotoEnd(false)
Cursor.ParaStyleName = "Überschrift 2"
Cursor.String = "Stamm-Kneipp-Verein"+chr(13)
Cursor.gotoEnd(false)
Cursor.ParaStyleName = "Standard"
Cursor.CharWeight = 200
Cursor.String = "Alle anderen Veranstaltungen und Kurse entnehmen Sie bitte dem Jahresprogramm des Stamm-Kneipp-Vereins."+chr(10)
Cursor.gotoEnd(false)
Cursor.CharWeight = 100
Cursor.String = "Dieses finden Sie unter www.stamm-kneipp-verein.de im Internet."+chr(10)+_
"Die Geschäftsstelle des Stamm-Kneipp-Vereins erreichen Sie telefonisch "+_
"donnerstags von 16 - 18 Uhr unter 08247/34473 oder per E-Mail unter info@skv-bw.de."+chr(10)+chr(13)
Cursor.gotoEnd(false)
normal ("27",von,bis)
normal ("29",von,bis)
normal ("20",von,bis)
normal ("21",von,bis)
normal ("22",von,bis)
normal ("23",von,bis)
oProgressBarModel.ProgressValue = 40 'x ist neuer Wert
normal ("24",von,bis)
normal ("25",von,bis)
normal ("26",von,bis)
normal ("28",von,bis)
oProgressBarModel.ProgressValue = 50 'x ist neuer Wert
Cursor.gotoEnd(false)
Cursor.ParaStyleName = "Überschrift 2"
Cursor.String = "KATHOLISCHE KURSEELSORGE"+chr(13)
Cursor.gotoEnd(false)
Cursor.ParaStyleName = "Standard"
I = Cursor.CharHeight
Cursor.CharHeight = 14
Cursor.String = "KURGOTTESDIENSTE"+chr(10)
Cursor.gotoEnd(false)
Cursor.CharHeight = I
Cursor.String = "Sonntag"+chr(9)+"11:00 Uhr"+chr(9)+"Stadtpfarrkirche St. Justina"+chr(10)+_
"Mittwoch"+chr(9)+"11:00 Uhr"+chr(9)+"Kirche der Dominikanerinnen"+chr(10)+_
"Freitag"+chr(9)+"11:00 Uhr"+chr(9)+"Kirche der Dominikanerinnen"+chr(13)
Cursor.gotoEnd(false)
Cursor.CharWeight = 200
Cursor.String = "Montag"+chr(9)+"19:00 Uhr"+chr(9)+"Kneippianum"+chr(10)+chr(9)+chr(9)+"(Sprechzeiten können vereinbart werden)"+chr(10)+_
"Dienstag"+chr(9)+"17:15 Uhr"+chr(9)+"Sebastianeum"+chr(10)+chr(9)+chr(9)+"(Sprechzeiten können vereinbart werden)"+chr(10)+_
"Freitag"+chr(9)+"17:25 Uhr"+chr(9)+"Kneipp-Kurhaus St. Joseph"+chr(10)+chr(9)+chr(9)+"(Sprechzeiten können vereinbart werden)"+chr(13)
Cursor.gotoEnd(false)
Cursor.paraStyleName = "Standard1"
Cursor.CharWeight = 100
I = Cursor.CharHeight
Cursor.CharHeight = 14
Cursor.String = chr(10)+"SPRECHSTUNDEN und BEICHTGESPRÄCHE"+chr(10)
Cursor.gotoEnd(false)
Cursor.CharHeight = I
Cursor.CharWeight = 200
Cursor.String = "im Haus der Kurseelsorge, Promenadestraße 1"+chr(10)
Cursor.gotoEnd(false)
Cursor.CharWeight = 100
Cursor.String = chr(9)+"Dienstag"+chr(9)+"10:00 - 12:00 Uhr"+chr(10)+_
chr(9)+"Mittwoch"+chr(9)+"9:00 – 10:30 Uhr"+chr(10)+_
chr(9)+"Donnerstag"+chr(9)+"10:00 - 12:00 Uhr"+chr(10)+_
chr(9)+"Freitag"+chr(9)+"9:00 - 10:30 Uhr"+chr(10)+_
chr(9)+"oder nach Vereinbarung (Tel. 23 13)"+chr(13)
Cursor.gotoEnd(false)
I = Cursor.CharHeight
Cursor.CharHeight = 14
Cursor.String = chr(10)+"BÜROZEITEN im Haus der Kurseelsorge"+chr(10)
Cursor.gotoEnd(false)
Cursor.CharHeight = I
Cursor.CharWeight = 100
Cursor.String = chr(9)+"Mo. bis Mi. "
Cursor.gotoEnd(false)
Cursor.CharWeight = 200
Cursor.String = "und"
Cursor.gotoEnd(false)
Cursor.CharWeight = 100
Cursor.String = " Fr."+chr(9)+"14:00 bis 16:30 Uhr"+chr(10)+chr(13)
Cursor.gotoEnd(false)
Cursor.paraStyleName = "Standard"
I = Cursor.CharHeight
Cursor.CharHeight = 14
Cursor.String = chr(10)+"ANSCHRIFT"+chr(10)
Cursor.gotoEnd(false)
Cursor.CharHeight = I
Cursor.CharWeight = 100
Cursor.String = chr(9)+"Kurseelsorger:"+chr(9)
Cursor.gotoEnd(false)
Cursor.CharWeight = 200
Cursor.String = "Pater Rüdiger Prziklang CMM"+chr(10)
Cursor.gotoEnd(false)
Cursor.CharWeight = 100
Cursor.String = chr(9)+"Haus der"+chr(9)+"Promenadestraße 1"+chr(10)+_
chr(9)+"Kurseelsorge"+chr(9)+"(gegenüber der alten Wandelhalle)"+chr(10)+_
chr(9)+chr(9)+"86825 Bad Wörishofen"+chr(10)+_
chr(9)+"Telefon:"+chr(9)+"(0 82 47) 23 13"+chr(10)+_
chr(9)+"Fax:"+chr(9)+"(0 82 47) 3 47 66"+chr(10)+_
chr(9)+"E-Mail:"+chr(9)+"kurseelsorge@vr-web.de"+chr(13)
Cursor.gotoEnd(false)
normalfoku ("1",von,bis)
Ausflug ("2",von,bis)
oProgressBarModel.ProgressValue = 60 'x ist neuer Wert
Cursor.gotoEnd(false)
Cursor.ParaStyleName = "Überschrift 2"
Cursor.String = "STADTPFARREI ST. JUSTINA"+chr(13)
Cursor.gotoEnd(false)
Cursor.ParaStyleName = "Standard2"
Cursor.CharWeight = 200
Cursor.String = "Anschriften:"+chr(10)+_
"Stadtpfarrer Rudolf Gaißmayer"+chr(10)
Cursor.gotoEnd(false)
Cursor.CharWeight = 100
Cursor.String = "Hauptstraße 23"+chr(9)+"86825 Bad Wörishofen"+chr(9)+"Tel. 27 36"+chr(10)
Cursor.gotoEnd(false)
Cursor.CharWeight = 200
Cursor.String = "Organist Matthias Häusler"+chr(10)
Cursor.gotoEnd(false)
Cursor.CharWeight = 100
Cursor.String = "Schwabenstr. 35"+chr(9)+"86825 Bad Wörishofen"+chr(9)+"Tel. 99 86 87"+chr(10)
Cursor.gotoEnd(false)
Cursor.CharWeight = 200
Cursor.String = "Benefiziat Pater Alex Kallarackal CST"+chr(10)
Cursor.gotoEnd(false)
Cursor.CharWeight = 100
Cursor.String = "Klosterhof 4"+chr(9)+"86825 Bad Wörishofen"+chr(9)+"Tel. 21 04"+chr(10)
Cursor.gotoEnd(false)
Cursor.CharWeight = 200
Cursor.String = "Gemeindereferentin Hannelore Kasztner"+chr(10)
Cursor.gotoEnd(false)
Cursor.CharWeight = 100
Cursor.String = "Hauptstraße 23"+chr(9)+"86825 Bad Wörishofen"+chr(9)+"Tel. 9 63 69 42"+chr(10)
Cursor.gotoEnd(false)
Cursor.CharWeight = 200
Cursor.String = "Pfarrbüro Georg Trautmann"+chr(10)
Cursor.gotoEnd(false)
Cursor.CharWeight = 100
Cursor.String = "Hauptstraße 23"+chr(9)+"86825 Bad Wörishofen"+chr(9)+"Tel. 27 36"+chr(10)+chr(13)
Cursor.gotoEnd(false)
normal ("30",von,bis)
normal ("31",von,bis)
Cursor.gotoEnd(false)
Cursor.ParaStyleName = "Überschrift 2"
Cursor.String = "Jugend St. Justina"+chr(13)
Cursor.gotoEnd(false)
Table = oMyDoc.createInstance("com.sun.star.text.TextTable")
Table.Initialize(1,2)
oMyDoc.Text.insertTextContent(Cursor, Table, False)
with oLinie
.Color = rgb(0,0,0)
.outerLineWidth = 0
.LineDistance = 0
.innerLineWidth = 0
end with
with oRahmen
.TopLine = oLinie
.BottomLine = oLinie
.LeftLine = oLinie
.RightLine = oLinie
.VerticalLine = oLinie
.HorizontalLine = oLinie
.IsBottomLineValid = true
.IsDistanceValid = true
.IsHorizontalLineValid = true
.IsLeftLineValid = true
.IsRightLineValid = true
.IsTopLineValid = true
.IsVerticalLineValid = true
end with
table.TableBorder = oRahmen
Spalte = Table.TableColumnSeparators()
Spalte(0).Position = 1500
Table.TableColumnSeparators = Spalte
Cell = Table.getCellByPosition(0,0)
CellCursor = Cell.CreateTextCursor()
CellCursor.String = "Sonntags"+chr(10)+"20:00 Uhr"
Cell = Table.getCellByPosition(1,0)
CellCursor = Cell.CreateTextCursor()
CellCursor.String = "in der 'OASE' im Benefiziatenhaus"+chr(10)
CellCursor.gotoEndOfParagraph(false)
CellCursor.CharWeight = 200
CellCursor.CharUnderline = 1
CellCursor.String = "Treffen der Jugend (H)"
CellCursor.gotoEndOfParagraph(false)
CellCursor.CharHeight = 6
CellCursor.String = chr(13)
Cursor.gotoEnd(false)
normal ("32",von,bis)
normal ("33",von,bis)
normal ("34",von,bis)
normal ("35",von,bis)
oProgressBarModel.ProgressValue = 70 'x ist neuer Wert
normal ("40",von,bis)
normal ("41",von,bis)
Cursor.gotoEnd(false)
Cursor.ParaStyleName = "Überschrift 2"
Cursor.String = "PFARREIENGEMEINSCHAFT ST. ULRICH"+chr(13)
Cursor.gotoEnd(false)
Cursor.ParaStyleName = "Standard2"
Cursor.CharWeight = 200
Cursor.String = "Anschriften:"+chr(10)+_
"Pfarrer Michael Kratschmer"+chr(10)
Cursor.gotoEnd(false)
Cursor.CharWeight = 100
Cursor.String = "Kirchenstraße 3"+chr(9)+"86825 Bad Wörishofen"+chr(9)+"Tel. 58 31"+chr(10)
Cursor.gotoEnd(false)
Cursor.CharWeight = 200
Cursor.String = "Pfarrer Friedrich Lutz"+chr(10)
Cursor.gotoEnd(false)
Cursor.CharWeight = 100
Cursor.String = "Kirchenstraße 5"+chr(9)+"86825 Bad Wörishofen"+chr(9)+"Tel. 30 87 20"+chr(10)
Cursor.gotoEnd(false)
Cursor.CharWeight = 200
Cursor.String = "Pfarrer Alfons Riedle"+chr(10)
Cursor.gotoEnd(false)
Cursor.CharWeight = 100
Cursor.String = "Fellhornweg 2a"+chr(9)+"86825 Bad Wörishofen"+chr(9)+"Tel. 3 48 17"+chr(10)
Cursor.gotoEnd(false)
Cursor.CharWeight = 200
Cursor.String = "Gemeindereferentin Christine Schaffranek"+chr(10)
Cursor.gotoEnd(false)
Cursor.CharWeight = 100
Cursor.String = "Kirchenstraße 3"+chr(9)+"86825 Bad Wörishofen"+chr(9)+"Tel. 9 62 65 71"+chr(10)
Cursor.gotoEnd(false)
Cursor.CharWeight = 200
Cursor.String = "Pfarrbüro Rosina Schmid"+chr(10)
Cursor.gotoEnd(false)
Cursor.CharWeight = 100
Cursor.String = "Kirchenstraße 3"+chr(9)+"86825 Bad Wörishofen"+chr(9)+"Tel. 58 31"+chr(10)+chr(13)
Cursor.gotoEnd(false)
normal ("80",von,bis)
' Cursor.gotoEnd(false)
' Cursor.ParaStyleName = "Überschrift 2"
' Cursor.String = "Sonstige Veranstaltungen"+chr(13)
' Cursor.gotoEnd(false)
' Table = oMyDoc.createInstance("com.sun.star.text.TextTable")
' Table.Initialize(1,2)
' oMyDoc.Text.insertTextContent(Cursor, Table, False)
' with oLinie
' .Color = rgb(0,0,0)
' .outerLineWidth = 0
' .LineDistance = 0
' .innerLineWidth = 0
' end with
' with oRahmen
' .TopLine = oLinie
' .BottomLine = oLinie
' .LeftLine = oLinie
' .RightLine = oLinie
' .VerticalLine = oLinie
' .HorizontalLine = oLinie
' .IsBottomLineValid = true
' .IsDistanceValid = true
' .IsHorizontalLineValid = true
' .IsLeftLineValid = true
' .IsRightLineValid = true
' .IsTopLineValid = true
' .IsVerticalLineValid = true
' end with
' table.TableBorder = oRahmen
' Spalte(0).Position = 1500
' Table.TableColumnSeparators = Spalte
' Cell = Table.getCellByPosition(0,0)
' CellCursor = Cell.CreateTextCursor()
' CellCursor.String = "jeden"+chr(10)+"Montag"+chr(10)+"8.00 Uhr"
' Cell = Table.getCellByPosition(1,0)
' CellCursor = Cell.CreateTextCursor()
' CellCursor.String = "im Ostpark, am See"
' CellCursor.gotoEndofParagraph(false)
' CellCursor.CharWeight = 200
' CellCursor.String = " (bei trockenem Wetter!)"+chr(10)
' CellCursor.gotoEndOfParagraph(false)
' CellCursor.CharUnderline = 1
' CellCursor.String = "Chi Gong im Alltag mit Anleitung"+chr(10)
' CellCursor.gotoEndOfParagraph(false)
' CellCursor.CharUnderline = 0
' CellCursor.String = "Ref.: Beate Zinner, "
' CellCursor.gotoEndofParagraph(false)
' CellCursor.CharWeight = 100
' CellCursor.String = "Bad Wörishofen"
' CellCursor.gotoEndOfParagraph(false)
' CellCursor.CharHeight = 6
' CellCursor.String = chr(13)
normal ("81",von,bis)
Cursor.gotoEnd(false)
Cursor.ParaStyleName = "Überschrift 2"
Cursor.String = "Seniorenkreis 'Herbst-Zeit-Lose'"+chr(13)
Cursor.gotoEnd(false)
Cursor.ParaStyleName = "Standard"
Cursor.CharWeight = 200
Cursor.String = "Die Senioren treffen sich jeden Donnerstag im Pfarrhaus St. Ulrich"+chr(10)+"um 14.30 Uhr"+chr(13)
Cursor.gotoEnd(false)
normal ("82",von,bis)
normal ("83",von,bis)
Cursor.gotoEnd(false)
Cursor.ParaStyleName = "Überschrift 2"
Cursor.String = "Offener Bibelkreis St. Ulrich"+chr(13)
Cursor.gotoEnd(false)
Table = oMyDoc.createInstance("com.sun.star.text.TextTable")
Table.Initialize(1,2)
oMyDoc.Text.insertTextContent(Cursor, Table, False)
with oLinie
.Color = rgb(0,0,0)
.outerLineWidth = 0
.LineDistance = 0
.innerLineWidth = 0
end with
with oRahmen
.TopLine = oLinie
.BottomLine = oLinie
.LeftLine = oLinie
.RightLine = oLinie
.VerticalLine = oLinie
.HorizontalLine = oLinie
.IsBottomLineValid = true
.IsDistanceValid = true
.IsHorizontalLineValid = true
.IsLeftLineValid = true
.IsRightLineValid = true
.IsTopLineValid = true
.IsVerticalLineValid = true
end with
table.TableBorder = oRahmen
'Spalte = Table.TableColumnSeparators()
Spalte(0).Position = 1500
Table.TableColumnSeparators = Spalte
Cell = Table.getCellByPosition(0,0)
CellCursor = Cell.CreateTextCursor()
CellCursor.String = "Dienstags"+chr(10)+"20:00 Uhr"
Cell = Table.getCellByPosition(1,0)
CellCursor = Cell.CreateTextCursor()
CellCursor.String = "im Pfarrzentrum St. Ulrich, Gartenstadt"+chr(10)
CellCursor.gotoEndOfParagraph(false)
CellCursor.CharWeight = 200
CellCursor.String = "Bibelgebetskreis: "
CellCursor.gotoEndOfParagraph(false)
CellCursor.CharUnderline = 1
CellCursor.String = "Das Sonntagsevangelium"
CellCursor.gotoEndOfParagraph(false)
CellCursor.CharHeight = 6
CellCursor.String = chr(13)
Cursor.gotoEnd(false)
oProgressBarModel.ProgressValue = 80 'x ist neuer Wert
normal ("84",von,bis)
oProgressBarModel.ProgressValue = 90 'x ist neuer Wert
normal ("50",von,bis)
normal ("51",von,bis)
normal ("60",von,bis)
normal ("61",von,bis)
normal ("70",von,bis)
normal ("71",von,bis)
wait(2000)
oProgressBarModel.ProgressValue = 100 'x ist neuer Wert
msgBox "Das Dokument wurde erstellt!"
End Sub
Sub Staendige (orga as String,von as String,bis as String)
Dim I as Integer
Dim J as Integer
Dim oMyDoc as Object
Dim oDatabaseContext as Object
Dim DatabaseContext as Object
Dim DataSource as Object
Dim Statement as Object
Dim ResultSet as Object
Dim ResultSet1 as Object
Dim InteractionHandler as Object
Dim Connection as Object
Dim CellName As String
Dim Cursor As Object
Dim CellCursor as Object
Dim Table as Object
dim oLinie as new com.sun.star.table.BorderLine
dim oRahmen as new com.sun.star.table.TableBorder
Dim Spalte()
Dim Cell As Object
Dim s as String
Dim ueb1 as String, ueb2 as String, ueb3 as String, ueb4 as String, ueb5 as String, ueb6 as String
Dim ueb7 as String, ueb8 as String, ueb9 as String
Dim dummytext as String
Dim queries as Object
Dim oAbfrage as Object
Dim query as String
dim oText as String
oDataBaseContext = createUNOService("com.sun.star.sdb.DatabaseContext")
DataSource = oDatabaseContext.getByName("bwforum")
If Not DataSource.IsPasswordRequired Then
Connection = DataSource.GetConnection("","")
Else
InteractionHandler = createUnoService("com.sun.star.sdb.InteractionHandler")
Connection = DataSource.ConnectWithCompletion(InteractionHandler)
End If
queries = oDatabaseContext.getByName("bwforum").getQueryDefinitions().getbyname("Programm_lang")
query = queries.command+" AND ( `termin`.`DATUM` >= '"+von+"' AND `termin`.`DATUM` <= '"+bis+_
"') AND (`termin`.`ORGID` = "+orga+" ) AND (`termin`.`STAENDIG` = 1) order by Datum ASC"
'print query
Statement = Connection.createStatement()
ResultSet1 = Statement.executeQuery(query)
oMyDoc = StarDesktop.CurrentComponent
Cursor = oMyDoc.Text.createTextCursor()
Cursor.gotoEnd(false)
oText = ""
If Not IsNull(ResultSet1) Then
Table = oMyDoc.createInstance("com.sun.star.text.TextTable")
Table.Initialize(1,2)
oMyDoc.Text.insertTextContent(Cursor, Table, False)
with oLinie
.Color = rgb(0,0,0)
.outerLineWidth = 0
.LineDistance = 0
.innerLineWidth = 0
end with
with oRahmen
.TopLine = oLinie
.BottomLine = oLinie
.LeftLine = oLinie
.RightLine = oLinie
.VerticalLine = oLinie
.HorizontalLine = oLinie
.IsBottomLineValid = true
.IsDistanceValid = true
.IsHorizontalLineValid = true
.IsLeftLineValid = true
.IsRightLineValid = true
.IsTopLineValid = true
.IsVerticalLineValid = true
end with
table.TableBorder = oRahmen
Spalte = Table.TableColumnSeparators()
Spalte(0).Position = 1500
Table.TableColumnSeparators = Spalte
Cell = Table.getCellByPosition(0,0)
CellCursor = Cell.CreateTextCursor()
while ResultSet1.next
I = I+1
Wend
Statement = Connection.createStatement()
ResultSet1 = Statement.executeQuery(query)
oText = ""
while ResultSet1.Next
J=J+1
wait(150)
if J < I then
oText = oText+Right(ResultSet1.getString(1),2)+"."+Mid(ResultSet1.getString(1),6,2)+"."+Mid(ResultSet1.getString(1),3,2)+chr(13)
wait(150)
else
oText = oText+Right(ResultSet1.getString(1),2)+"."+Mid(ResultSet1.getString(1),6,2)+"."+Mid(ResultSet1.getString(1),3,2)+chr(13)+ResultSet1.getString(2)+" Uhr"
end if
Wend
CellCursor.String = oText
Cell = Table.getCellByPosition(1,0)
CellCursor = Cell.CreateTextCursor()
'xray CellCursor
Statement = Connection.createStatement()
ResultSet1 = Statement.executeQuery(query)
oText = ""
J = 0
while ResultSet1.Next
J=J+1
wait(150)
if J < I then
wait(100)
else
if Resultset1.getstring(3)<>"" then
CellCursor.String = ResultSet1.getString(3)+chr(10)
endif
CellCursor.gotoEndOfParagraph(false)
if Resultset1.getstring(4)<>"" then
CellCursor.CharWeight = 200
CellCursor.CharUnderline = 1
CellCursor.String = ResultSet1.getString(4)
endif
CellCursor.gotoEndOfParagraph(false)
CellCursor.CharWeight = 100
CellCursor.CharUnderline = 0
if Resultset1.getstring(5)<>"" then
CellCursor.CharWeight = 200
CellCursor.String = chr(10)+ResultSet1.getString(5)+" "
endif
CellCursor.gotoEndOfParagraph(false)
if Resultset1.getstring(6)<>"" then
CellCursor.CharWeight = 200
if Resultset1.getstring(5) = "" then
CellCursor.String = chr(10)+ResultSet1.getString(6)+" "
else
CellCursor.String = ResultSet1.getString(6)+" "
endif
endif
CellCursor.gotoEndOfParagraph(false)
if Resultset1.getstring(7)<>"" then
CellCursor.CharWeight = 200
CellCursor.String = ResultSet1.getString(7)+", "
endif
CellCursor.gotoEndOfParagraph(false)
if Resultset1.getstring(8)<>"" then
CellCursor.CharWeight = 100
CellCursor.String = ResultSet1.getString(8)+chr(10)
endif
CellCursor.gotoEndOfParagraph(false)
if Resultset1.getstring(9)<>"" then
oText = CStr(Resultset1.getstring(9))
wait(150)
if ResultSet1.getstring(5)+ResultSet1.getstring(6)+ResultSet1.getstring(7)+ResultSet1.getstring(8) = "" then
CellCursor.String = chr(10)+Resultat(oText)
else
CellCursor.String = Resultat(oText)
endif
CellCursor.String = Resultat(oText)
endif
CellCursor.gotoEndOfParagraph(false)
if Resultset1.getstring(10)<>"" then
CellCursor.String = "Unkostenbeitrag"+chr(9)+ResultSet1.getString(10)+" €"
endif
CellCursor.gotoEndOfParagraph(false)
if Resultset1.getstring(11)<>"" then
CellCursor.String = chr(10)+"ermäßigt"+chr(9)+ResultSet1.getString(11)+" €"
endif
CellCursor.gotoEndOfParagraph(false)
CellCursor.CharHeight = 6
CellCursor.String = chr(13)
end if
Wend
End if
g=g+1
End Sub
Sub Staendige1213 (orga as String,von as String,bis as String)
Dim I as Integer
Dim J as Integer
Dim oMyDoc as Object
Dim oDatabaseContext as Object
Dim DatabaseContext as Object
Dim DataSource as Object
Dim Statement as Object
Dim ResultSet as Object
Dim ResultSet1 as Object
Dim InteractionHandler as Object
Dim Connection as Object
Dim CellName As String
Dim Cursor As Object
Dim CellCursor as Object
Dim Table as Object
dim oLinie as new com.sun.star.table.BorderLine
dim oRahmen as new com.sun.star.table.TableBorder
Dim Spalte()
Dim Spalte1()
Dim Cell As Object
Dim s as String
Dim ueb1 as String, ueb2 as String, ueb3 as String, ueb4 as String, ueb5 as String, ueb6 as String
Dim ueb7 as String, ueb8 as String, ueb9 as String
Dim dummytext as String
Dim queries as Object
Dim oAbfrage as Object
Dim query as String
dim oText as String
oDataBaseContext = createUNOService("com.sun.star.sdb.DatabaseContext")
DataSource = oDatabaseContext.getByName("bwforum")
If Not DataSource.IsPasswordRequired Then
Connection = DataSource.GetConnection("","")
Else
InteractionHandler = createUnoService("com.sun.star.sdb.InteractionHandler")
Connection = DataSource.ConnectWithCompletion(InteractionHandler)
End If
queries = oDatabaseContext.getByName("bwforum").getQueryDefinitions().getbyname("Programm_lang")
query = queries.command+" AND ( `termin`.`DATUM` >= '"+von+"' AND `termin`.`DATUM` <= '"+bis+_
"') AND (`termin`.`ORGID` = "+orga+" ) AND (`termin`.`STAENDIG` = 1) order by Datum ASC"
'print query
Statement = Connection.createStatement()
ResultSet1 = Statement.executeQuery(query)
oMyDoc = StarDesktop.CurrentComponent
Cursor = oMyDoc.Text.createTextCursor()
Cursor.gotoEnd(false)
oText = ""
If Not IsNull(ResultSet1) Then
Table = oMyDoc.createInstance("com.sun.star.text.TextTable")
Table.Initialize(1,2)
oMyDoc.Text.insertTextContent(Cursor, Table, False)
with oLinie
.Color = rgb(0,0,0)
.outerLineWidth = 0
.LineDistance = 0
.innerLineWidth = 0
end with
with oRahmen
.TopLine = oLinie
.BottomLine = oLinie
.LeftLine = oLinie
.RightLine = oLinie
.VerticalLine = oLinie
.HorizontalLine = oLinie
.IsBottomLineValid = true
.IsDistanceValid = true
.IsHorizontalLineValid = true
.IsLeftLineValid = true
.IsRightLineValid = true
.IsTopLineValid = true
.IsVerticalLineValid = true
end with
table.TableBorder = oRahmen
Spalte = Table.TableColumnSeparators()
Spalte(0).Position = 1500
Table.TableColumnSeparators = Spalte
Cell = Table.getCellByPosition(0,0)
CellCursor = Cell.CreateTextCursor()
while ResultSet1.next
I = I+1
Wend
Statement = Connection.createStatement()
ResultSet1 = Statement.executeQuery(query)
oText = ""
while ResultSet1.Next
J=J+1
wait(150)
if J < I then
oText = oText+Right(ResultSet1.getString(1),2)+"."+Mid(ResultSet1.getString(1),6,2)+"."+Mid(ResultSet1.getString(1),3,2)+chr(13)
wait(150)
else
oText = oText+Right(ResultSet1.getString(1),2)+"."+Mid(ResultSet1.getString(1),6,2)+"."+Mid(ResultSet1.getString(1),3,2)+chr(13)
end if
Wend
CellCursor.String = oText
Cell = Table.getCellByPosition(1,0)
CellCursor = Cell.CreateTextCursor()
'xray CellCursor
Statement = Connection.createStatement()
ResultSet1 = Statement.executeQuery(query)
oText = ""
J = 0
while ResultSet1.Next
J=J+1
wait(150)
if J < I then
wait(100)
else
if Resultset1.getstring(3)<>"" then
CellCursor.String = ResultSet1.getString(3)+chr(10)
endif
CellCursor.gotoEndOfParagraph(false)
if Resultset1.getstring(4)<>"" then
CellCursor.CharWeight = 200
CellCursor.CharUnderline = 1
CellCursor.String = ResultSet1.getString(4)
endif
CellCursor.gotoEndOfParagraph(false)
CellCursor.CharWeight = 100
CellCursor.CharUnderline = 0
if Resultset1.getstring(5)<>"" then
CellCursor.CharWeight = 200
CellCursor.String = chr(10)+ResultSet1.getString(5)+" "
endif
CellCursor.gotoEndOfParagraph(false)
if Resultset1.getstring(6)<>"" then
CellCursor.CharWeight = 200
if Resultset1.getstring(5) = "" then
CellCursor.String = chr(10)+ResultSet1.getString(6)+" "
else
CellCursor.String = ResultSet1.getString(6)+" "
endif
endif
CellCursor.gotoEndOfParagraph(false)
if Resultset1.getstring(7)<>"" then
CellCursor.CharWeight = 200
CellCursor.String = ResultSet1.getString(7)+", "
endif
CellCursor.gotoEndOfParagraph(false)
if Resultset1.getstring(8)<>"" then
CellCursor.CharWeight = 100
CellCursor.String = ResultSet1.getString(8)+chr(10)
endif
CellCursor.gotoEndOfParagraph(false)
if Resultset1.getstring(9)<>"" then
oText = CStr(Resultset1.getstring(9))
wait(150)
if ResultSet1.getstring(5)+ResultSet1.getstring(6)+ResultSet1.getstring(7)+ResultSet1.getstring(8) = "" then
CellCursor.String = chr(10)+Resultat(oText)
else
CellCursor.String = Resultat(oText)
endif
CellCursor.String = Resultat(oText)
endif
end if
Wend
End if
g=g+1
CellCursor.gotoEndOfParagraph(false)
CellCursor.CharWeight = 200
CellCursor.gotoEndOfParagraph(false)
CellCursor.String =chr(10)+"Krankenkassen – immer mehr erkennen dieses Tanzen in ihrem Bonusprogramm an."
CellCursor.gotoEndOfParagraph(false)
Table = oMyDoc.createInstance("com.sun.star.text.TextTable")
Table.Initialize(1,2)
oMyDoc.Text.insertTextContent(Cursor, Table, False)
with oLinie
.Color = rgb(0,0,0)
.outerLineWidth = 0
.LineDistance = 0
.innerLineWidth = 0
end with
with oRahmen
.TopLine = oLinie
.BottomLine = oLinie
.LeftLine = oLinie
.RightLine = oLinie
.VerticalLine = oLinie
.HorizontalLine = oLinie
.IsBottomLineValid = true
.IsDistanceValid = true
.IsHorizontalLineValid = true
.IsLeftLineValid = true
.IsRightLineValid = true
.IsTopLineValid = true
.IsVerticalLineValid = true
end with
table.TableBorder = oRahmen
Spalte1 = Table.TableColumnSeparators()
Spalte1(0).Position = 1500
Table.TableColumnSeparators = Spalte
Cell = Table.getCellByPosition(0,0)
CellCursor = Cell.CreateTextCursor()
CellCursor.String = "15:00-16:45"+chr(10)+chr(10)+"17:00-18:45"
Cell = Table.getCellByPosition(1,0)
CellCursor = Cell.CreateTextCursor()
CellCursor.CharWeight = 200
CellCursor.gotoEndOfParagraph(false)
CellCursor.String ="Tänze – einfach zum Mitmachen mit Anleitung"+chr(10)
CellCursor.gotoEndOfParagraph(false)
CellCursor.CharWeight = 100
CellCursor.gotoEndOfParagraph(false)
CellCursor.String ="Unkostenbeitrag 3,00 €"+chr(10)
CellCursor.gotoEndOfParagraph(false)
CellCursor.CharWeight = 200
CellCursor.gotoEndOfParagraph(false)
CellCursor.String ="Internationale Folklore"+chr(10)+"Gesellschaftstänze in geselliger Form mit Anleitung"+chr(10)+"Tanzerfahrung erwünscht!"+chr(10)
CellCursor.gotoEndOfParagraph(false)
CellCursor.CharWeight = 100
CellCursor.gotoEndOfParagraph(false)
CellCursor.String ="Unkostenbeitrag 3,00 €"
CellCursor.gotoEndOfParagraph(false)
CellCursor.CharHeight = 6
CellCursor.String = chr(13)
End Sub
Sub normal (orga as String,von as String,bis as String)
Dim I as Integer
Dim J as Integer
Dim oMyDoc as Object
Dim oDatabaseContext as Object
Dim DatabaseContext as Object
Dim DataSource as Object
Dim Statement as Object
Dim ResultSet as Object
Dim ResultSet1 as Object
Dim InteractionHandler as Object
Dim Connection as Object
Dim Cursor As Object
Dim CellCursor as Object
Dim Table as Object
Dim CellName As String
Dim Spalte()
Dim Cell As Object
Dim s as String
Dim ueb1 as String, ueb2 as String, ueb3 as String, ueb4 as String, ueb5 as String, ueb6 as String
Dim ueb7 as String, ueb8 as String, ueb9 as String
Dim dummytext as String
Dim queries as Object
Dim oAbfrage as Object
Dim query as String
dim oText as String
dim oDate as Date
dim oLinie as new com.sun.star.table.BorderLine
dim oRahmen as new com.sun.star.table.TableBorder
oDataBaseContext = createUNOService("com.sun.star.sdb.DatabaseContext")
DataSource = oDatabaseContext.getByName("bwforum")
If Not DataSource.IsPasswordRequired Then
Connection = DataSource.GetConnection("","")
Else
InteractionHandler = createUnoService("com.sun.star.sdb.InteractionHandler")
Connection = DataSource.ConnectWithCompletion(InteractionHandler)
End If
queries = oDatabaseContext.getByName("bwforum").getQueryDefinitions().getbyname("Programm_lang")
query = queries.command+" AND ( `termin`.`DATUM` >= '"+von+"' AND `termin`.`DATUM` <= '"+bis+_
"') AND (`termin`.`ORGID` = "+orga+" ) AND (`termin`.`STAENDIG` = 0 OR `termin`.`ORGID` = "+27+") order by Datum ASC"
'print query
Statement = Connection.createStatement()
ResultSet1 = Statement.executeQuery(query)
oMyDoc = StarDesktop.CurrentComponent
Cursor = oMyDoc.Text.createTextCursor()
Cursor.gotoEnd(false)
If Not IsNull(ResultSet1) Then
Statement = Connection.createStatement()
ResultSet1 = Statement.executeQuery(query)
oText = ""
oText = ""
while ResultSet1.next
I = I+1
Wend
Cursor.ParaStyleName = "Überschrift 2"
if (orga = 1 or orga = 10)Then
if I > 1 then
Cursor.String = "Vorträge"
else
Cursor.String = "Vortrag"
end If
end if
if I > 0 Then
if not (orga = 1 or orga = 10) then
Cursor.String = Ueberschrift(orga)
End If
End If
Cursor.gotoEnd(false)
Statement = Connection.createStatement()
ResultSet1 = Statement.executeQuery(query)
while ResultSet1.Next
oText = ""
Table = oMyDoc.createInstance("com.sun.star.text.TextTable")
Table.Initialize(1,2)
oMyDoc.Text.insertTextContent(Cursor, Table, False)
with oLinie
.Color = rgb(0,0,0)
.outerLineWidth = 0
.LineDistance = 0
.innerLineWidth = 0
end with
with oRahmen
.TopLine = oLinie
.BottomLine = oLinie
.LeftLine = oLinie
.RightLine = oLinie
.VerticalLine = oLinie
.HorizontalLine = oLinie
.IsBottomLineValid = true
.IsDistanceValid = true
.IsHorizontalLineValid = true
.IsLeftLineValid = true
.IsRightLineValid = true
.IsTopLineValid = true
.IsVerticalLineValid = true
end with
table.TableBorder = oRahmen
Spalte = Table.TableColumnSeparators()
Spalte(0).Position = 1500
Table.TableColumnSeparators = Spalte
Cell = Table.getCellByPosition(0,0)
CellCursor = Cell.CreateTextCursor()
oDate = DateSerial (Left(ResultSet1.getString(1),4) , Mid(ResultSet1.getString(1),6,2) , Mid(ResultSet1.getString(1),9,2))
oText = Wochentag(oDate)
oText = oText+Right(ResultSet1.getString(1),2)+"."+Mid(ResultSet1.getString(1),6,2)+"."+Mid(ResultSet1.getString(1),3,2)+chr(13)+ResultSet1.getString(2)+" Uhr"
CellCursor.String = oText
Cell = Table.getCellByPosition(1,0)
CellCursor = Cell.CreateTextCursor()
oText = ""
if Resultset1.getstring(3)<>"" then
CellCursor.String = ResultSet1.getString(3)+chr(10)
endif
CellCursor.gotoEndOfParagraph(false)
if Resultset1.getstring(4)<>"" then
CellCursor.CharWeight = 200
CellCursor.CharUnderline = 1
if Resultset1.getstring(12) = 1 then
CellCursor.String = ResultSet1.getString(4)
else
CellCursor.String = ResultSet1.getString(4)+" (H)"
end If
endif
CellCursor.gotoEndOfParagraph(false)
CellCursor.CharUnderline = 0
if Resultset1.getstring(5)<>"" then
CellCursor.CharWeight = 200
CellCursor.String = chr(10)+ResultSet1.getString(5)+" "
endif
CellCursor.gotoEndOfParagraph(false)
if Resultset1.getstring(6)<>"" then
CellCursor.CharWeight = 200
if Resultset1.getstring(5) = "" then
CellCursor.String = chr(10)+ResultSet1.getString(6)+" "
else
CellCursor.String = ResultSet1.getString(6)+" "
endif
endif
CellCursor.gotoEndOfParagraph(false)
if Resultset1.getstring(7)<>"" then
CellCursor.CharWeight = 200
CellCursor.String = ResultSet1.getString(7)+", "
endif
CellCursor.gotoEndOfParagraph(false)
if Resultset1.getstring(8)<>"" then
CellCursor.CharWeight = 100
CellCursor.String = ResultSet1.getString(8)
endif
CellCursor.gotoEndOfParagraph(false)
CellCursor.CharUnderline = 0
CellCursor.CharWeight = 100
if Resultset1.getstring(9)<>"" then
oText = CStr(Resultset1.getstring(9))
wait(150)
' if ResultSet1.getstring(5)+ResultSet1.getstring(6)+ResultSet1.getstring(7)+ResultSet1.getstring(8) = "" then
' CellCursor.String = Resultat(oText)
' else
CellCursor.String = chr(10)+Resultat(oText)
' endif
CellCursor.gotoEndOfParagraph(false)
endif
CellCursor.gotoEndOfParagraph(false)
CellCursor.CharWeight = 100
if Resultset1.getstring(10)<>"" then
CellCursor.String = chr(10)+"Unkostenbeitrag"+chr(9)+ResultSet1.getString(10)+" €"
endif
CellCursor.gotoEndOfParagraph(false)
if Resultset1.getstring(11)<>"" then
CellCursor.String = chr(10)+"ermäßigt"+chr(9)+ResultSet1.getString(11)+" €"
endif
CellCursor.gotoEndOfParagraph(false)
CellCursor.CharHeight = 6
CellCursor.String = chr(13)
Wend
End if
g=g+1
End Sub
Sub normalfoku (orga as String,von as String,bis as String)
Dim I as Integer
Dim J as Integer
Dim oMyDoc as Object
Dim oDatabaseContext as Object
Dim DatabaseContext as Object
Dim DataSource as Object
Dim Statement as Object
Dim ResultSet as Object
Dim ResultSet1 as Object
Dim InteractionHandler as Object
Dim Connection as Object
Dim Cursor As Object
Dim CellCursor as Object
Dim Table as Object
Dim CellName As String
Dim Spalte()
Dim Cell As Object
Dim s as String
Dim ueb1 as String, ueb2 as String, ueb3 as String, ueb4 as String, ueb5 as String, ueb6 as String
Dim ueb7 as String, ueb8 as String, ueb9 as String
Dim dummytext as String
Dim queries as Object
Dim oAbfrage as Object
Dim query as String
dim oText as String
dim oDate as Date
dim oLinie as new com.sun.star.table.BorderLine
dim oRahmen as new com.sun.star.table.TableBorder
oDataBaseContext = createUNOService("com.sun.star.sdb.DatabaseContext")
DataSource = oDatabaseContext.getByName("bwforum")
If Not DataSource.IsPasswordRequired Then
Connection = DataSource.GetConnection("","")
Else
InteractionHandler = createUnoService("com.sun.star.sdb.InteractionHandler")
Connection = DataSource.ConnectWithCompletion(InteractionHandler)
End If
queries = oDatabaseContext.getByName("bwforum").getQueryDefinitions().getbyname("Programm_lang")
query = queries.command+" AND ( `termin`.`DATUM` >= '"+von+"' AND `termin`.`DATUM` <= '"+bis+_
"') AND (`termin`.`ORGID` = "+orga+" ) AND (`termin`.`STAENDIG` = 0 OR `termin`.`ORGID` = "+27+") order by Datum ASC"
'print query
Statement = Connection.createStatement()
ResultSet1 = Statement.executeQuery(query)
oMyDoc = StarDesktop.CurrentComponent
Cursor = oMyDoc.Text.createTextCursor()
Cursor.gotoEnd(false)
If Not IsNull(ResultSet1) Then
Statement = Connection.createStatement()
ResultSet1 = Statement.executeQuery(query)
oText = ""
oText = ""
while ResultSet1.next
I = I+1
Wend
Cursor.ParaStyleName = "Überschrift 2"
if (orga = 1 or orga = 10)Then
if I > 1 then
Cursor.String = "Vorträge"
else
Cursor.String = "Vortrag"
end If
end if
if I > 0 Then
if not (orga = 1 or orga = 10) then
Cursor.String = Ueberschrift(orga)
End If
End If
Cursor.gotoEnd(false)
Statement = Connection.createStatement()
ResultSet1 = Statement.executeQuery(query)
while ResultSet1.Next
oText = ""
Table = oMyDoc.createInstance("com.sun.star.text.TextTable")
Table.Initialize(1,2)
oMyDoc.Text.insertTextContent(Cursor, Table, False)
with oLinie
.Color = rgb(0,0,0)
.outerLineWidth = 0
.LineDistance = 0
.innerLineWidth = 0
end with
with oRahmen
.TopLine = oLinie
.BottomLine = oLinie
.LeftLine = oLinie
.RightLine = oLinie
.VerticalLine = oLinie
.HorizontalLine = oLinie
.IsBottomLineValid = true
.IsDistanceValid = true
.IsHorizontalLineValid = true
.IsLeftLineValid = true
.IsRightLineValid = true
.IsTopLineValid = true
.IsVerticalLineValid = true
end with
table.TableBorder = oRahmen
Spalte = Table.TableColumnSeparators()
Spalte(0).Position = 1500
Table.TableColumnSeparators = Spalte
Cell = Table.getCellByPosition(0,0)
CellCursor = Cell.CreateTextCursor()
oDate = DateSerial (Left(ResultSet1.getString(1),4) , Mid(ResultSet1.getString(1),6,2) , Mid(ResultSet1.getString(1),9,2))
oText = Wochentag(oDate)
oText = oText+Right(ResultSet1.getString(1),2)+"."+Mid(ResultSet1.getString(1),6,2)+"."+Mid(ResultSet1.getString(1),3,2)+chr(13)+ResultSet1.getString(2)+" Uhr"
CellCursor.String = oText
Cell = Table.getCellByPosition(1,0)
CellCursor = Cell.CreateTextCursor()
oText = ""
if Resultset1.getstring(3)<>"" then
CellCursor.String = ResultSet1.getString(3)+chr(10)
endif
CellCursor.gotoEndOfParagraph(false)
if Resultset1.getstring(4)<>"" then
CellCursor.CharWeight = 200
CellCursor.CharUnderline = 1
if Resultset1.getstring(12) = 1 then
CellCursor.String = ResultSet1.getString(4)
else
CellCursor.String = ResultSet1.getString(4)+" (H)"
end If
endif
CellCursor.gotoEndOfParagraph(false)
CellCursor.CharUnderline = 0
if Resultset1.getstring(5)<>"" then
CellCursor.CharWeight = 200
CellCursor.String = chr(10)+ResultSet1.getString(5)+" "
endif
CellCursor.gotoEndOfParagraph(false)
if Resultset1.getstring(6)<>"" then
CellCursor.CharWeight = 200
if Resultset1.getstring(5) = "" then
CellCursor.String = chr(10)+ResultSet1.getString(6)+" "
else
CellCursor.String = ResultSet1.getString(6)+" "
endif
endif
CellCursor.gotoEndOfParagraph(false)
if Resultset1.getstring(7)<>"" then
CellCursor.CharWeight = 200
CellCursor.String = ResultSet1.getString(7)+", "
endif
CellCursor.gotoEndOfParagraph(false)
if Resultset1.getstring(8)<>"" then
CellCursor.CharWeight = 100
CellCursor.String = ResultSet1.getString(8)
endif
CellCursor.gotoEndOfParagraph(false)
CellCursor.CharUnderline = 0
CellCursor.CharWeight = 100
if Resultset1.getstring(9)<>"" then
oText = CStr(Resultset1.getstring(9))
wait(150)
' if ResultSet1.getstring(5)+ResultSet1.getstring(6)+ResultSet1.getstring(7)+ResultSet1.getstring(8) = "" then
' CellCursor.String = Resultat(oText)
' else
CellCursor.String = chr(10)+Resultat(oText)
' endif
CellCursor.gotoEndOfParagraph(false)
endif
CellCursor.gotoEndOfParagraph(false)
CellCursor.CharWeight = 100
if Resultset1.getstring(10)<>"" then
CellCursor.String = chr(10)+"Unkostenbeitrag"+chr(9)+ResultSet1.getString(10)+" €"
endif
CellCursor.gotoEndOfParagraph(false)
if Resultset1.getstring(11)<>"" then
CellCursor.String = chr(10)+"mit Kurkarte"+chr(9)+ResultSet1.getString(11)+" €"
endif
CellCursor.gotoEndOfParagraph(false)
CellCursor.String = chr(10)+"Karten an der Abendkasse 30 Minuten vor Veranstaltungsbeginn"
CellCursor.gotoEndOfParagraph(false)
CellCursor.CharHeight = 6
CellCursor.String = chr(13)
Wend
End if
g=g+1
End Sub
Sub Ausflug (orga as String,von as String,bis as String)
Dim I as Integer
Dim J as Integer
Dim oMyDoc as Object
Dim oDatabaseContext as Object
Dim DatabaseContext as Object
Dim DataSource as Object
Dim Statement as Object
Dim ResultSet as Object
Dim ResultSet1 as Object
Dim InteractionHandler as Object
Dim Connection as Object
Dim Cursor As Object
Dim CellCursor as Object
Dim Table as Object
Dim CellName As String
Dim Spalte()
Dim Cell As Object
Dim s as String
Dim ueb1 as String, ueb2 as String, ueb3 as String, ueb4 as String, ueb5 as String, ueb6 as String
Dim ueb7 as String, ueb8 as String, ueb9 as String
Dim dummytext as String
Dim queries as Object
Dim oAbfrage as Object
Dim query as String
dim oText as String
dim oDate as Date
dim oLinie as new com.sun.star.table.BorderLine
dim oRahmen as new com.sun.star.table.TableBorder
oDataBaseContext = createUNOService("com.sun.star.sdb.DatabaseContext")
DataSource = oDatabaseContext.getByName("bwforum")
If Not DataSource.IsPasswordRequired Then
Connection = DataSource.GetConnection("","")
Else
InteractionHandler = createUnoService("com.sun.star.sdb.InteractionHandler")
Connection = DataSource.ConnectWithCompletion(InteractionHandler)
End If
queries = oDatabaseContext.getByName("bwforum").getQueryDefinitions().getbyname("Programm_lang")
query = queries.command+" AND ( `termin`.`DATUM` >= '"+von+"' AND `termin`.`DATUM` <= '"+bis+_
"') AND (`termin`.`ORGID` = "+orga+" ) AND (`termin`.`STAENDIG` = 0) order by Datum ASC"
'print query
Statement = Connection.createStatement()
ResultSet1 = Statement.executeQuery(query)
oMyDoc = StarDesktop.CurrentComponent
Cursor = oMyDoc.Text.createTextCursor()
Cursor.gotoEnd(false)
If Not IsNull(ResultSet1) Then
Statement = Connection.createStatement()
ResultSet1 = Statement.executeQuery(query)
oText = ""
while ResultSet1.next
I = I+1
Wend
Cursor.ParaStyleName = "Überschrift 2"
if I > 1 then
Cursor.String = "Kurausflüge"+chr(13)
else
Cursor.String = "Kurausflug"+chr(13)
end If
Cursor.gotoEnd(false)
if I > 0 then
Cursor.paraStyleName = "Standard"
Cursor.CharWeight = 200
Cursor.String = chr(9)+"Leitung:"+chr(9)
Cursor.gotoEnd(false)
Cursor.CharWeight = 100
Cursor.String = "Pater Rüdiger Prziklang CMM, Kurseelsorger"+chr(10)
Cursor.gotoEnd(false)
Cursor.CharWeight = 200
Cursor.String = chr(9)+"Anmeldung:"+chr(9)
Cursor.gotoEnd(false)
Cursor.CharWeight = 100
Cursor.String = "im Haus der Kurseelsorge, Promenadestraße 1"+chr(10)+_
chr(9)+chr(9)+"während der Geschäftszeiten"+chr(10)+_
chr(9)+chr(9)+"Telefon: 08247 / 2313"+chr(10)
Cursor.gotoEnd(false)
Cursor.CharWeight = 200
Cursor.String = chr(9)+"Abfahrt:"+chr(9)+"13:00 Uhr am Klosterhof"+chr(10)+_
chr(9)+"Rückkunft:"+chr(9)+"ca. 18:00 Uhr"+chr(10)+_
chr(9)+"Fahrpreis:"+chr(9)
Cursor.gotoEnd(false)
Cursor.CharWeight = 100
Cursor.String = "€ 13,00 mit Führung"+chr(10)+chr(13)
Cursor.gotoEnd(false)
end if
Statement = Connection.createStatement()
ResultSet1 = Statement.executeQuery(query)
while ResultSet1.Next
oText = ""
Table = oMyDoc.createInstance("com.sun.star.text.TextTable")
Table.Initialize(1,2)
oMyDoc.Text.insertTextContent(Cursor, Table, False)
with oLinie
.Color = rgb(0,0,0)
.outerLineWidth = 0
.LineDistance = 0
.innerLineWidth = 0
end with
with oRahmen
.TopLine = oLinie
.BottomLine = oLinie
.LeftLine = oLinie
.RightLine = oLinie
.VerticalLine = oLinie
.HorizontalLine = oLinie
.IsBottomLineValid = true
.IsDistanceValid = true
.IsHorizontalLineValid = true
.IsLeftLineValid = true
.IsRightLineValid = true
.IsTopLineValid = true
.IsVerticalLineValid = true
end with
table.TableBorder = oRahmen
Spalte = Table.TableColumnSeparators()
Spalte(0).Position = 1500
Table.TableColumnSeparators = Spalte
Cell = Table.getCellByPosition(0,0)
CellCursor = Cell.CreateTextCursor()
oDate = DateSerial (Left(ResultSet1.getString(1),4) , Mid(ResultSet1.getString(1),6,2) , Mid(ResultSet1.getString(1),9,2))
oText = Wochentag(oDate)
oText = oText+Right(ResultSet1.getString(1),2)+"."+Mid(ResultSet1.getString(1),6,2)+"."+Mid(ResultSet1.getString(1),3,2)
CellCursor.String = oText
Cell = Table.getCellByPosition(1,0)
CellCursor = Cell.CreateTextCursor()
oText = ""
if Resultset1.getstring(4)<>"" then
CellCursor.CharWeight = 200
CellCursor.CharUnderline = 1
CellCursor.String = ResultSet1.getString(4)+chr(10)
endif
CellCursor.gotoEndOfParagraph(false)
CellCursor.CharWeight = 100
CellCursor.CharUnderline = 0
if Resultset1.getstring(9)<>"" then
oText = CStr(Resultset1.getstring(9))
wait(150)
CellCursor.String = Resultat(oText)
CellCursor.gotoEndOfParagraph(false)
CellCursor.CharHeight = 6
CellCursor.String = chr(13)
endif
Wend
End if
g = g+1
End Sub
Function Rahmen
dim oLinie as new com.sun.star.table.BorderLine
dim oRahmen as new com.sun.star.table.TableBorder
with oLinie
.Color = rgb(0,0,0)
.outerLineWidth = 0
.LineDistance = 0
.innerLineWidth = 0
end with
with oRahmen
.TopLine = oLinie
.BottomLine = oLinie
.LeftLine = oLinie
.RightLine = oLinie
.VerticalLine = oLinie
.HorizontalLine = oLinie
.IsBottomLineValid = true
.IsDistanceValid = true
.IsHorizontalLineValid = true
.IsLeftLineValid = true
.IsRightLineValid = true
.IsTopLineValid = true
.IsVerticalLineValid = true
end with
Rahmen = oLinie
end Function
Function Wochentag(datum as date)
Select case WeekDay(datum)
case 1
Wochentag = "Sonntag,"+chr(10)
case 2
Wochentag = "Montag,"+chr(10)
case 3
Wochentag = "Dienstag,"+chr(10)
case 4
Wochentag = "Mittwoch,"+chr(10)
case 5
Wochentag = "Donnerstag,"+chr(10)
case 6
Wochentag = "Freitag,"+chr(10)
case 7
Wochentag = "Samstag,"+chr(10)
End Select
End Function
Function Resultat(source As String) 'entferne chr(13)
Dim Search As String
Dim NewPart As String
Dim StartPos As Long
Dim CurrentPos As Long
Search = chr(13)
NewPart = ""
Resultat = ""
StartPos = 1
CurrentPos = 1
Do While CurrentPos <> 0
CurrentPos = InStr(StartPos, Source, Search)
If CurrentPos <> 0 Then
Resultat = Resultat + Mid(Source, StartPos, _
CurrentPos - StartPos)
Resultat = Resultat + NewPart
StartPos = CurrentPos + Len(Search)
Else
Resultat = Resultat + Mid(Source, StartPos, Len(Source))
End If ' Position <> 0
Loop
End Function
Function Ueberschrift(orga as String)
select case orga
case 21
Ueberschrift = "Kurklinik Kneippianum"
case 22
Ueberschrift = "Kneipp-Kurhaus St. Josef"
case 23
Ueberschrift = "Kneippmuseum"
case 25
Ueberschrift = "Singgemeinschaft Liedertafel"
case 26
Ueberschrift = "musica-sacra-chor"
case 28
Ueberschrift = "Frauenbund Bezirk Bad Wörishofen"
case 29
Ueberschrift = "Kurdirektion Bad Wörishofen"
case 31
Ueberschrift = "Frauenbund St. Justina"
case 33
Ueberschrift = "Kolpingsfamilie"
case 34
Ueberschrift = "Seniorentreff 60 plus"
case 35
Ueberschrift = "Bücherei St. Justina"
case 40
Ueberschrift = "Pfarrei Mariä Heimsuchung"
case 41
Ueberschrift = "Frauenbund Mariä Heimsuchung"
case 50
Ueberschrift = "Pfarrei St. Martin"
case 51
Ueberschrift = "Frauenbund St. Martin"
case 60
Ueberschrift = "Pfarrei St. Michael"
case 61
Ueberschrift = "Frauenbund St. Michael"
case 70
Ueberschrift = "Pfarrei St. Stephan"
case 71
Ueberschrift = "Frauenbund St. Stephan"
case 81
Ueberschrift = "Frauenbund St. Ulrich"
case 83
Ueberschrift = "Seniorenkreis 'Vitale'"
end Select
End Function
Nach ein bisschen rumprobieren bin ich mir fast sicher, dass es nicht am Dokument liegt. wenn ich nach jeder "Standard 2" Zuweisung noch Cursor.CharWeight und CharHeight zuweise sieht es wieder aus wie früher. Aber das ist nicht wirklich Sinn der Sache.
Eine Ausleitung aus Base aus dem Formular Programmerstellung liegt zur Veranschaulichung hier:
Hier habe ich das erste mal eine Abweichung von der Vorlage. Fett ist nicht mehr aktiv (bei "KATHOLISCHE KURSEELSORGE").
Später geht dann auch noch die Schriftgröße verloren (10,5 statt 16).
Danke schon mal für Dein Interesse.