05-31-2024, 04:29 PM
(05-31-2024, 01:07 PM)SMcNeill Wrote:I would love the ability to paste directly from rich text into the forums editor, but if not then maybe we can create a QB64PE tool that takes a rich text copy of a table in the clipboard and autogenerates markdown from it, including links & basic text formatting?(05-31-2024, 12:56 PM)Jack Wrote: @SMcNeill
how did you enter that table?
trying to quote your post doesn't work for me, this forum works differently from every other forum that I visit, in those forums when you click on "reply with quote" it opens an edit box with the quoted message, on this forum when I click on quote nothing happenstable <-- starts the table, with the =## representing the percent width of the screen you want it to use.Code: (Select All)[table=80]
[tr][th] [style=background: #0000FF; color: #FFFFFF;] Person [/style] [/th][th] [style=background: #0000FF; color: #FFFFFF;] Awesomeness[/style][/th][/tr]
[tr][td] [style=background: Red; color: MidnightBlue; width: 70px;] Steve [/style][/td][td]ULTIMATE!!![/td][/tr]
[tr][td]Everyone Else[/td][td]meh...[/td][/tr]
[/table]
tr <-- this makes a row in the table
td <-- and this is a divider (so it makes columns)
th <-- and this does those headers (which is basically just a column with some highlight and color built in.)
and slash (/) before those code commands is needed to show where each table/column/row/header ends.
For now I have Excel to avoid manually typing in everything, for example this table (from QB64.com > C Libraries)
C++ Variable Types
C Name | Description | Size | QB64 Type |
---|---|---|---|
Character or small integer. | 1 byte | ||
Short Integer(Word) | 2 byte | ||
Integer(Dword) | 4 byte | ||
Int32, Long integer or Long | 4 byte | ||
Long long (Qword) | 8 byte | ||
Boolean value true or false. | 1 byte | ||
Floating point number | 4 byte | ||
Double precision floating. | 8 byte | ||
Long double precision float | 10 byte | ||
2 or 4 | |||
void pointer(void *) | ANY |
Was generated with Excel using the below macros for the links and some formulas (see screenshot for how to set up the formulas). Paste the table into the sheet and the row markdown is calculated in cells M2-M(endrow)...
Code: (Select All)
' /////////////////////////////////////////////////////////////////////////////
' FROM:
' vba - Extract URL From Excel Hyperlink Formula - Stack Overflow
' https://stackoverflow.com/questions/32230657/extract-url-from-excel-hyperlink-formula
' Excel VBA to extract Hyperlink from Hyperlink Formula - Super User
' https://superuser.com/questions/1313339/excel-vba-to-extract-hyperlink-from-hyperlink-formula
Public Function GetHyperLinkAddress(ByVal Target As Excel.Range) As String
Dim RoutineName As String:: RoutineName = "GetHyperLinkAddress"
Dim sFormula As String
Dim sExpression As String
Dim iStart As Long
Dim iPos As Long
Dim iEnd As Long
Dim sURL As String
Dim sSubAddress As String
Dim sFind As String
'Set Target = ActiveCell
sURL = ""
On Error Resume Next ' handle errors manually
If Target.Hyperlinks.Count > 0 Then
sURL = Target.Hyperlinks(1).Address
sSubAddress = Target.Hyperlinks(1).SubAddress
If Len(sSubAddress) > 0 Then
sURL = sURL & "#" & sSubAddress
End If
ElseIf Target.HasFormula Then
sFormula = Target.Formula
sFind = "HYPERLINK("
iPos = InStr(1, sFormula, sFind, vbTextCompare)
If (iPos > 0) Then
iEnd = InStr(iPos + 1, sFormula, ",", vbTextCompare)
If (iEnd > 0) Then
iStart = iPos + Len(sFind)
sExpression = Mid(sFormula, iStart, iEnd - iStart)
sURL = Evaluate(sExpression)
End If
End If
End If
If Err.Number <> 0 Then
Debug.Print CStr(Now) & " " & RoutineName & " failed with error #" & CStr(Err.Number) & ": " & Err.Description
Err.Clear
sURL = ""
End If
On Error Goto 0 ' resume automatic error handling
GetHyperLinkAddress = sURL
End Function ' GetHyperLinkAddress
' /////////////////////////////////////////////////////////////////////////////
Public Function GetURL(ByVal Target As Excel.Range) As String
Application.Volatile
GetURL = GetHyperLinkAddress(Target)
End Function ' GetURL