reference main library instead of duplicating code

This commit is contained in:
Paul Trowbridge 2017-09-28 14:28:38 -04:00
parent b0c229065a
commit c2fc14e50b

80
FL.bas
View File

@ -582,50 +582,15 @@ Sub LoadChan()
End Sub
Sub markdown_from_selection()
Sub markdown_from_table()
Dim wapi As New Windows_API
Dim x As New TheBigOne
Dim wapi As New Windows_API
Dim tbl() As Variant
tbl = Selection
Dim msl() As Integer
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)
Call wapi.ClipBoard_SetData(x.markdown_from_table(tbl))
End Sub
@ -634,30 +599,17 @@ Sub json_multirange()
Dim wapi As New Windows_API
Dim x As New TheBigOne
Dim r As range
Dim ar As range
Dim r1() As Variant
Dim r2() As Variant
Dim rslt As String
Dim d() As String
Dim i As Integer
Dim dest As String
Set r = Selection
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(x.json_multirange(Selection))
Call wapi.ClipBoard_SetData(rslt)
End Sub
Sub markdown_whole_sheet()
Dim x As New TheBigOne
Dim wapi As New Windows_API
End Sub
Call wapi.ClipBoard_SetData(x.markdown_whole_sheet(ActiveSheet))
End Sub