reference main library instead of duplicating code
This commit is contained in:
parent
b0c229065a
commit
c2fc14e50b
78
FL.bas
78
FL.bas
@ -582,50 +582,15 @@ Sub LoadChan()
|
|||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Sub markdown_from_table()
|
||||||
|
|
||||||
|
|
||||||
Sub markdown_from_selection()
|
|
||||||
|
|
||||||
Dim wapi As New Windows_API
|
|
||||||
Dim x As New TheBigOne
|
Dim x As New TheBigOne
|
||||||
|
Dim wapi As New Windows_API
|
||||||
Dim tbl() As Variant
|
Dim tbl() As Variant
|
||||||
|
|
||||||
tbl = Selection
|
tbl = Selection
|
||||||
|
|
||||||
Dim msl() As Integer
|
Call wapi.ClipBoard_SetData(x.markdown_from_table(tbl))
|
||||||
Dim md As String
|
|
||||||
Dim r As Integer
|
|
||||||
Dim c As Integer
|
|
||||||
|
|
||||||
ReDim msl(UBound(tbl, 2))
|
|
||||||
|
|
||||||
'---determine max string length per column----
|
|
||||||
For c = 1 To UBound(tbl, 2)
|
|
||||||
For r = 1 To UBound(tbl, 1)
|
|
||||||
If Len(tbl(r, c)) > msl(c) Then msl(c) = Len(tbl(r, c))
|
|
||||||
Next r
|
|
||||||
Next c
|
|
||||||
|
|
||||||
'---build markdown table-----------
|
|
||||||
For r = 1 To UBound(tbl, 1)
|
|
||||||
If r = 2 Then
|
|
||||||
md = md & "|"
|
|
||||||
For c = 1 To UBound(tbl, 2)
|
|
||||||
md = md & "---" & String(x.MISCe_MaxInt(msl(c), 3) - 3, "-") & "|"
|
|
||||||
Next c
|
|
||||||
md = md & vbCrLf
|
|
||||||
End If
|
|
||||||
md = md & "|"
|
|
||||||
For c = 1 To UBound(tbl, 2)
|
|
||||||
md = md & tbl(r, c) & String(x.MISCe_MaxInt(3, msl(c) - Len(tbl(r, c))), " ") & "|"
|
|
||||||
Next c
|
|
||||||
md = md & vbCrLf
|
|
||||||
Next r
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Call wapi.ClipBoard_SetData(md)
|
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
@ -634,30 +599,17 @@ Sub json_multirange()
|
|||||||
|
|
||||||
Dim wapi As New Windows_API
|
Dim wapi As New Windows_API
|
||||||
Dim x As New TheBigOne
|
Dim x As New TheBigOne
|
||||||
Dim r As range
|
Call wapi.ClipBoard_SetData(x.json_multirange(Selection))
|
||||||
Dim ar As range
|
|
||||||
Dim r1() As Variant
|
End Sub
|
||||||
Dim r2() As Variant
|
|
||||||
Dim rslt As String
|
|
||||||
Dim d() As String
|
Sub markdown_whole_sheet()
|
||||||
Dim i As Integer
|
|
||||||
Dim dest As String
|
Dim x As New TheBigOne
|
||||||
|
Dim wapi As New Windows_API
|
||||||
Set r = Selection
|
|
||||||
|
Call wapi.ClipBoard_SetData(x.markdown_whole_sheet(ActiveSheet))
|
||||||
i = 1
|
|
||||||
For Each ar In r.Areas
|
|
||||||
|
|
||||||
r1 = ar
|
|
||||||
If i > 1 Then
|
|
||||||
rslt = rslt & "," & x.json_from_table(r1, CStr(r1(1, 1)), True)
|
|
||||||
Else
|
|
||||||
rslt = x.json_from_table(r1, CStr(r1(1, 1)), True)
|
|
||||||
End If
|
|
||||||
i = i + 1
|
|
||||||
Next ar
|
|
||||||
rslt = "{" & rslt & "}"
|
|
||||||
|
|
||||||
Call wapi.ClipBoard_SetData(rslt)
|
|
||||||
|
|
||||||
End Sub
|
End Sub
|
Loading…
Reference in New Issue
Block a user