1
+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2
+ <!DOCTYPE script:module PUBLIC "-//OpenOffice.org//DTD OfficeDocument 1.0//EN" "module.dtd">
3
+ <script : module xmlns : script =" http://openoffice.org/2000/script" script : name =" TcNoControl" script : language =" StarBasic" >
4
+
5
+
6
+
7
+ Function GetCellPositionRow(Cell) as integer
8
+ oSheet = ThisComponent.getCurrentController().getActiveSheet()
9
+ oCell = oSheet.getCellRangeByName(Cell)
10
+ aCellAddress = oCell.getCellAddress()
11
+ GetCellPositionRow = aCellAddress.Row
12
+ End Function
13
+
14
+
15
+ Function GetCellPositionColumn(Cell) as integer
16
+ oSheet = ThisComponent.getCurrentController().getActiveSheet()
17
+ oCell = oSheet.getCellRangeByName(Cell)
18
+ aCellAddress = oCell.getCellAddress()
19
+ GetCellPositionColumn = aCellAddress.Column
20
+ End Function
21
+
22
+
23
+ Function Control(CellRow, CellColumn)
24
+
25
+ Dim objActiveSheet as object
26
+ Dim oCell as object
27
+ Dim mod1 as Integer, mod2 As Integer
28
+ Dim TC1 as Integer, TC2 as Integer, TC3 as Integer, TC4 as Integer, TC5 as Integer, TC6 as Integer, TC7 as Integer, TC8 as Integer, TC9 as Integer, TC10 as Integer, TC11 As Integer
29
+ objActiveSheet = ThisComponent.getCurrentController().getActiveSheet()
30
+ oCell = objActiveSheet.getCellByPosition(CellColumn, CellRow)
31
+ ControlVal = oCell.Value
32
+
33
+ TC1 = Mid(ControlVal, 1, 1)
34
+ TC2 = Mid(ControlVal, 2, 1)
35
+ TC3 = Mid(ControlVal, 3, 1)
36
+ TC4 = Mid(ControlVal, 4, 1)
37
+ TC5 = Mid(ControlVal, 5, 1)
38
+ TC6 = Mid(ControlVal, 6, 1)
39
+ TC7 = Mid(ControlVal, 7, 1)
40
+ TC8 = Mid(ControlVal, 8, 1)
41
+ TC9 = Mid(ControlVal, 9, 1)
42
+ TC10 = Mid(ControlVal, 10, 1)
43
+ TC11 = Mid(ControlVal, 11, 1)
44
+
45
+ mod1 = ((((TC1 + TC3 + TC5 + TC7 + TC9) * 7) - (TC2 + TC4 + TC6 + TC8)) Mod 10)
46
+ mod2 = ((TC1 + TC2 + TC3 + TC4 + TC5 + TC6 + TC7 + TC8 + TC9 + TC10) Mod 10)
47
+
48
+ If Len(ControlVal) <> 11 Then
49
+ oCell.CharColor = RGB(255, 0, 0)
50
+ Else
51
+ If mod1 <> TC10 or mod2 <> TC11 Then
52
+ oCell.CharColor = RGB(255, 0, 0)
53
+ ElseIf TC11 mod(2) <> 0 Then
54
+ oCell.CharColor = RGB(255, 0, 0)
55
+ Else
56
+ oCell.CharColor = RGB(0, 0, 0)
57
+ End If
58
+ End If
59
+ End Function
60
+
61
+
62
+
63
+ Sub TcKimlikKontrol
64
+
65
+
66
+ Dim i as integer
67
+ Dim oCurrentController as variant
68
+ Dim oActiveSheet as variant
69
+ Dim oObj1 as variant
70
+ Dim aRangeAddress as new com.sun.star.table.CellRangeAddress
71
+ Dim nEndRow as long
72
+ Dim target as string
73
+ Dim colstr as string
74
+ Dim rawstr as string
75
+
76
+
77
+ P = " TC Kimlik numaraları hangi sü tunda bulunuyor?"
78
+ colstr = InputBox(P)
79
+ P = " TC Kimlik numaraları hangi satırdan itibaren bulunuyor?"
80
+ rawstr = InputBox(P)
81
+ target = colstr + rawstr
82
+ row =GetCellPositionRow(target)
83
+ col =GetCellPositionColumn(target)
84
+
85
+
86
+
87
+ oCurrentController = ThisComponent.getCurrentController()
88
+ oActiveSheet = oCurrentController.getActiveSheet()
89
+ oObj1 = oActiveSheet.createCursor()
90
+
91
+ oObj1.gotoEndOfUsedArea(False)
92
+ aRangeAddress = oObj1.getRangeAddress()
93
+ nEndRow = aRangeAddress.EndRow
94
+
95
+ for i = row to nEndRow
96
+ Control(i, col)
97
+ next i
98
+
99
+
100
+ End Sub
101
+
102
+
103
+ </script : module >
0 commit comments