Android Question Webview adding an image to the bottom

Smee

Well-Known Member
Licensed User
Longtime User
I am trying to add a picture as a Legend to the bottom of a generated html table. I am using the code from dbutils ExecuteHtml. Everything works fine except when I try to ad a legend in a footer the words wrap at the edge of the screen rather than continue to the width of the table. So i thought this could be overcome by using a picture as a legend but I cannot find a way to add it to the bottom of the table
Any ideas?
Thanks for any help
 

ronell

Well-Known Member
Licensed User
Longtime User
i dont have much knowledge in dbutils but i can help you if you post the relevant codes or upload the project
 
Upvote 0

Smee

Well-Known Member
Licensed User
Longtime User
Hi,
Thanks for your offer. The dbUtils is just a code library which makes it very easy to produce TNL Table output. The code is here
https://www.b4x.com/android/forum/threads/dbutils-android-databases-are-now-simple.8475/#content

the relevant routine i guess is this
B4X:
'Creates a html text that displays the data in a table.
'The style of the table can be changed by modifying HtmlCSS variable.
Sub ExecuteHtml(SQL As SQL, Query As String, StringArgs() As String, Limit As Int, Clickable As Boolean) As String

    Dim Footer As String
    Dim Table As List
    Dim cur As Cursor
    If StringArgs <> Null Then
        cur = SQL.ExecQuery2(Query, StringArgs)
    Else
        cur = SQL.ExecQuery(Query)
    End If
    Log("ExecuteHtml: " & Query)
    If Limit > 0 Then Limit = Min(Limit, cur.RowCount) Else Limit = cur.RowCount

    Dim sb As StringBuilder
    sb.Initialize
    sb.Append("<html><body>").Append(CRLF)
    sb.Append("<style type='text/css'>").Append(HtmlCSS).Append("</style>").Append(CRLF)
    sb.Append("<table><tr>").Append(CRLF)
 
    sb.Append(CRLF)
    sb.Append("Test The Caption").Append(CRLF)

    For i = 0 To cur.ColumnCount - 1
        sb.Append("<th>").Append(cur.GetColumnName(i)).Append("</th>")
    Next
    sb.Append("</tr>").Append(CRLF)
    For row = 0 To Limit - 1
        cur.Position = row
        If row Mod 2 = 0 Then
            sb.Append("<tr>")
        Else
            sb.Append("<tr class='odd'>")
        End If
        For i = 0 To cur.ColumnCount - 1
            sb.Append("<td>")
            If Clickable Then
                sb.Append("<a href='http://").Append(i).Append(".")
                sb.Append(row)
                sb.Append(".com'>").Append(cur.GetString2(i)).Append("</a>")
            Else
                sb.Append(cur.GetString2(i))
            End If
            sb.Append("</td>")
        Next
        sb.Append("</tr>").Append(CRLF)
    Next
    cur.Close
    sb.Append("</table></body></html>")
'    sb.Append(Footer).Append(CRLF)
    Return sb.ToString

End Sub
 
Upvote 0

ronell

Well-Known Member
Licensed User
Longtime User
B4X:
    sb.Append($"</table>
("<img src='file:///android_asset/image.png'>")
</body></html>"$)

this also works
 
Upvote 0

Smee

Well-Known Member
Licensed User
Longtime User
I just managed to get it working with this
B4X:
    sb.Append("<img src=" & FileNamex & "><br>")
and went to post and saw all the replies.

Thaanks very much guys
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…