WebGadget table nowrap ellipsis
Verfasst: 03.01.2017 16:58
Hallo,
ich möchte in eine WebGadget eine HTML-Tabelle mit feste Spaltenbreite darstellen.
Der Text darf nur auf eine Zeile angezeigt werden (white-space: nowrap).
Wenn der Text zu lang ist, sollte gekappt werden (overflow: hidden; text-overflow: ellipsis;)
Leider funktioniert nicht so wie gewollt.
Wenn ich die Leerzeichen in der Datei mit z.B. _ ersetzt, funktioniert gut.
Mit "white-space: nowrap" müsste gehen.
HTML-Datei:
NACHTRAG:
Mit FF wird die HTML-Datei richtig dargestellt.
Liegt es an WebGadget ?
Danke
MarcelX
ich möchte in eine WebGadget eine HTML-Tabelle mit feste Spaltenbreite darstellen.
Der Text darf nur auf eine Zeile angezeigt werden (white-space: nowrap).
Wenn der Text zu lang ist, sollte gekappt werden (overflow: hidden; text-overflow: ellipsis;)
Leider funktioniert nicht so wie gewollt.
Wenn ich die Leerzeichen in der Datei mit z.B. _ ersetzt, funktioniert gut.
Mit "white-space: nowrap" müsste gehen.
Code: Alles auswählen
Enumeration
#myWindow
EndEnumeration
Enumeration
#myWebGadget
EndEnumeration
Procedure.s ReadHTML()
fichier.s = OpenFileRequester("Please choose file to load", "c:\","*.*|*.*", 0)
If ReadFile(0, fichier) ; txt-file
While Eof(0)=0
Texte$ = Texte$+ReadString(0)+Chr(13)+Chr(10)
Wend
CloseFile(0)
Else
MessageRequester("Message", "Erreur", 0)
EndIf
ProcedureReturn Texte$
EndProcedure
OpenWindow(#myWindow, #PB_Any, #PB_Any, 800, 615, "")
WebGadget(#myWebGadget, 5, 35, 790, 250, "")
HTML.s = ReadHTML()
SetGadgetItemText(#myWebGadget, #PB_Web_HtmlCode, HTML)
Repeat
EventW = WaitWindowEvent()
Until eventW = #PB_Event_CloseWindow
Code: Alles auswählen
<html>
<head>
<title>test</title>
<style>
#col1 { width: 120px; }
#col2 { width: 150px; }
table, th, td {border: 1px solid black; }
table {border-collapse: collapse; white-space: nowrap;
table-layout: fixed; border:1; width: 270px;}
th, td {overflow: hidden; text-overflow: ellipsis; white-space: nowrap;}
</style>
</head>
<body>
<table>
<col id="col1">
<col id="col2">
<thead>
<tr>
<th>1This cells has more content zz|</th>
<th>column 2XXXzzzz fffddd|</th>
</tr>
</thead>
<tbody>
<tr>
<td>1.1This cells has more content|</td>
<td>1\2 qwert asdfg xcvb|</td>
</tr>
</tbody>
</table>
</body>
</html>
Mit FF wird die HTML-Datei richtig dargestellt.
Liegt es an WebGadget ?
Danke
MarcelX