j4GDQaQsbkxeX8r2MoqWe changeset

Changeset326561343166 (b)
ParentNone (a)
ab
0+Sub Main()
0+    Dim x As Long
0+    Dim y As Long
0+    Dim l As String
0+    Dim a As Variant
0+   
0+    a = Selection.Value
0+    If 1 < UBound(a, 1) Then
0+        If 1 < UBound(a, 2) Then
0+            LineFill a, UBound(a, 1), UBound(a, 2), 1, 1
0+        End If
0+    End If
0+   
0+    For y = LBound(a, 1) To UBound(a, 1)
0+        l = ""
0+        For x = LBound(a, 2) To UBound(a, 2)
0+            l = l & a(y, x)
0+        Next
0+        Debug.Print l
0+    Next
0+End Sub
0+
0+Sub LineFill(a As Variant, my As Long, mx As Long, y As Long, x As Long)
0+    Dim i As Long
0+    Dim ny As Long
0+    Dim nx As Long
0+   
0+    For i = y + 1 To my
0+        If Not IsEmpty(a(i, x)) Then
0+            Exit For
0+        End If
0+    Next
0+    ny = i
0+    nx = x + 1
0+   
0+    For i = ny - 1 To y + 1 Step -1
0+        If Not IsEmpty(a(i, x + 1)) Then
0+            Exit For
0+        End If
0+        a(i, x) = " "
0+    Next
0+    a(i, x) = "└"
0+    For i = i - 1 To y + 1 Step -1
0+        If IsEmpty(a(i, x + 1)) Then
0+            a(i, x) = "│"
0+        Else
0+            a(i, x) = "├"
0+        End If
0+    Next
0+   
0+    If nx < mx Then
0+        If y + 1 < ny - 1 Then
0+            LineFill a, ny - 1, mx, y + 1, nx
0+        End If
0+    End If
0+    If ny < my Then
0+        LineFill a, my, mx, ny, x
0+    End If
0+End Sub
...
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
--- Revision None
+++ Revision 326561343166
@@ -0,0 +1,59 @@
+Sub Main()
+ Dim x As Long
+ Dim y As Long
+ Dim l As String
+ Dim a As Variant
+
+ a = Selection.Value
+ If 1 < UBound(a, 1) Then
+ If 1 < UBound(a, 2) Then
+ LineFill a, UBound(a, 1), UBound(a, 2), 1, 1
+ End If
+ End If
+
+ For y = LBound(a, 1) To UBound(a, 1)
+ l = ""
+ For x = LBound(a, 2) To UBound(a, 2)
+ l = l & a(y, x)
+ Next
+ Debug.Print l
+ Next
+End Sub
+
+Sub LineFill(a As Variant, my As Long, mx As Long, y As Long, x As Long)
+ Dim i As Long
+ Dim ny As Long
+ Dim nx As Long
+
+ For i = y + 1 To my
+ If Not IsEmpty(a(i, x)) Then
+ Exit For
+ End If
+ Next
+ ny = i
+ nx = x + 1
+
+ For i = ny - 1 To y + 1 Step -1
+ If Not IsEmpty(a(i, x + 1)) Then
+ Exit For
+ End If
+ a(i, x) = " "
+ Next
+ a(i, x) = "└"
+ For i = i - 1 To y + 1 Step -1
+ If IsEmpty(a(i, x + 1)) Then
+ a(i, x) = "│"
+ Else
+ a(i, x) = "├"
+ End If
+ Next
+
+ If nx < mx Then
+ If y + 1 < ny - 1 Then
+ LineFill a, ny - 1, mx, y + 1, nx
+ End If
+ End If
+ If ny < my Then
+ LineFill a, my, mx, ny, x
+ End If
+End Sub