Page Actions:
'---------- Date ------------
…
tDate=Day(DateValue(sDate)) & "/" & Month(DateValue(sDate)) & "/" & Year(DateValue(sDate))
' If iYear < 1950 Then
' tDate = Format$(DateValue(sDate), DateFormat49) '!!!
' ElseIf iYear < 2000 Then
' tDate = Format$(DateValue(sDate), DateFormat99)
' Else
' tDate = Format$(DateValue(sDate), DateFormat00)
' End If
' End If
...REM ***** BASIC ***** '========================================== ' Procedure: format_columns '========================================== sub format_columns Dim oSheet as Object, oCell as Object Dim cRow as Long Dim val as Single Dim str as String Dim txt as Variant Dim ctype as String, datestr as String, col3 as String, col4 as String, col11 as String, col12 as String Dim valuea() as String Dim i as Integer ' Define Empty type Dim EMPTYCELLTYPE EMPTYCELLTYPE = com.sun.star.table.CellContentType.EMPTY ' get current sheet set oSheet = ThisComponent.CurrentController.ActiveSheet ' for all rows with non empty 1. and 2. cells, fill cells in the row according to 1. cell cRow = 1 do while oSheet.getCellByPosition(0,cRow).getType() <> EMPTYCELLTYPE oCell=oSheet.getCellByPosition(15,cRow) ' str=oSheet.getCellByPosition(5,cRow).String ' (could be also .Value for numeric, .Text and .getValue) ' for i=1 to len(str) ' if mid(str,i,1)="," then str=left(str,i-1) & "." & mid(str,i+1) ' convert string to 00.00 format ' next i ' val=csng(str) ' convert to single val=oSheet.getCellByPosition(5,cRow).Value ctype = oSheet.getCellByPosition(7,cRow).Formula if ctype="D" then ' split debit and credit columns oSheet.getCellByPosition(8,cRow).setValue(val) oSheet.getCellByPosition(9,cRow).String="" else oSheet.getCellByPosition(8,cRow).String="" oSheet.getCellByPosition(9,cRow).setValue(val) end if oSheet.getCellByPosition(10,cRow).FormulaLocal=datestr ' could be .FormulaLocal for date or .String for string values) col3=oSheet.getCellByPosition(3,cRow).String col4=oSheet.getCellByPosition(4,cRow).String col11="" col12="" if ctype="K" then if InStr(col3,"ACCENTURE") then col11="Ienākumi:Valda alga" if col11="" then col11="Ienākumi:Citi" if InStr(col4,"Turnover") then col11="--Nevajag--" else if InStr(col4,"PIRKUMS") then col11="Pirkums" if InStr(col4,"NAUDAS IZSN") then if InStr(col4,"KOMISIJA") then col11="Pakalpojumi:Bankas" else col11="[Skaidrā nauda]" col12="Skaidrā nauda" end if end if if InStr(col3,"Mālkalne") then col11="Pakalpojumi:Ūdens un kanalizācija" if InStr(col3,"LATTELE") then col11="Pakalpojumi:Telefons" if InStr(col4,"LMT") then col11="Pakalpojumi:Mobilais telefons" if InStr(col3,"LATVENERGO") then col11="Pakalpojumi:Elektrība" if (InStr(col3,"LU MATEM") OR InStr(col4,"LU MATEM")) then col11="Pakalpojumi:Citi" if InStr(col4,"NESTE") then col11="Mašīna:Benzīns" if InStr(col4,"komisija") then col11="Pakalpojumi:Bankas" if InStr(col4,"Aizdevuma pamatsumma") then col11="[Kredīts]" col12="Kredīts" end if if InStr(col4,"Uzkrātie procenti") then col11="Pakalpojumi:Bankas kredītprocenti" if InStr(col3,"Vītoliņa") then col11="[Ievas karte]" col12="Ievas karte" end if if InStr(col3,"HANSA ELUKINDLUSTUS") then col11="Pakalpojumi:Bankas" col12="Dzīvības apdrošināšana" end if if InStr(col4,"Turnover") OR InStr(col4,"balance") then col11="--Nevajag--" if col11="" then col11="Pirkums" end if oSheet.getCellByPosition(10,cRow).String = col11 oSheet.getCellByPosition(11,cRow).String = col12 cRow = cRow + 1 loop end sub