graphviz autofit TD width in html label - html

With the following dot
digraph structs {
node [shape=plaintext]
struct1 [label=<
<table border="1">
<tr>
<td align="left">
<TABLE border="1">
<TR>
<TD align="left">one</TD>
<TD align="left">long text here</TD>
<TD align="left">c</TD>
</TR>
</TABLE>
</td>
</tr>
<tr>
<td align="left">
<TABLE border="1">
<TR>
<TD align="left">very long text present here</TD>
<TD align="left">colb</TD>
<TD align="left">colc</TD>
</TR>
</TABLE>
</td>
</tr>
</table>
>];
}
Graphviz yields the image below (my notes with red):
Now, if I take the table HTML from above and render it in the browser, I get what I would also expect from Graphviz:
Question: how can i get Graphviz to render the table same as the browser does (no extra-space inside the columns, but instead have it after the last column) ?
If it's not possible, how do I input the node label so that I get the same result as the browser returns?
Thank you.

Possible workarounds:
digraph structs {
node [shape=plaintext]
struct1 [label=<
<table border="1">
<tr>
<td align="left">
<TABLE border="0" width="1" fixedsize="true" align="left" cellpadding="0" cellsborder="0" CELLSPACING="0">
<TR>
<TD align="left">
<TABLE border="1" >
<TR>
<TD align="left">one</TD>
<TD align="left">long text here</TD>
<TD align="left">c</TD>
</TR>
</TABLE>
</TD>
</TR>
</TABLE>
</td>
</tr>
<tr>
<td align="left">
<TABLE border="1">
<TR>
<TD align="left">very long text present here</TD>
<TD align="left">colb</TD>
<TD align="left">colc</TD>
</TR>
</TABLE>
</td>
</tr>
</table>
>];
}
rendered on: http://viz-js.com/

Related

Filling an automatic-width table cell with a fixed-layout table

This sounds very similar to previous questions, but I've not found something that matches what I'm trying to do here.
My current code (very verbose with everything in line) looks like this:
td { border: 1px solid black }
<table style="table-layout:fixed">
<tr>
<td>
<table style="table-layout:fixed">
<tr>
<td style="background-color:red"></td>
<td style="background-color:limegreen;width:30px"></td>
<td style="background-color:blue"></td>
<tr>
</table>
</td>
<td>
<table style="table-layout:fixed">
<tr>
<td style="background-color:red"></td>
<td style="background-color:limegreen;width:30px"></td>
<td style="background-color:blue"></td>
<tr>
</table>
</td>
<td>
<table style="table-layout:fixed">
<tr>
<td style="background-color:red"></td>
<td style="background-color:limegreen;width:30px"></td>
<td style="background-color:blue"></td>
<tr>
</table>
</td>
<td>
<table style="table-layout:fixed">
<tr>
<td style="background-color:red"></td>
<td style="background-color:limegreen;width:30px"></td>
<td style="background-color:blue"></td>
<tr>
</table>
</td>
</tr>
<tr>
<td style="width:25%;text-align:center">Some text here</td>
<td style="width:25%;text-align:center">More text</td>
<td style="width:25%;text-align:center">Hi</td>
<td style="width:25%;text-align:center">Somewhat longer text</td>
</tr>
</table>
What I'm trying to accomplish should look like this:
That is, the four main columns should all be the same width, which is the width of the largest content of any of the columns.
The green columns should always be 30px, and the red and blue columns should fill the remaining space each side of that middle column, only up to the width available in the auto-sized outer column.
Setting the internal tables to 100% width makes this happen, but of course the outer table then takes up the entire page width.
I'm also aware that using tables for this is probably not a great idea now we can use CSS, but I'd like to get this example working in tables before 'translating' it.
I'm very opposed to using JavaScript to solve this, for the record!
Edit: I also tried putting all 'subcolumns' in one row, and setting the text to colspan three at a time, with the 25% then applied to that. This ended up confusing the engine, and the width ended up about 75% of the page.
<table style="table-layout:fixed" border="1">
<tr style="font-size: 1px;">
<td width="25%" colspan="3"> </td>
<td width="25%" colspan="3"> </td>
<td width="25%" colspan="3"> </td>
<td width="25%" colspan="3"> </td>
</tr>
<tr style="font-size: 6px;">
<td style="background-color:red"> </td>
<td style="background-color:green"><div style="width: 30px;"> </div></td>
<td style="background-color:blue"> </td>
<td style="background-color:red"> </td>
<td style="background-color:green"><div style="width: 30px;"> </div></td>
<td style="background-color:blue"> </td>
<td style="background-color:red"> </td>
<td style="background-color:green"><div style="width: 30px;"> </div></td>
<td style="background-color:blue"> </td>
<td style="background-color:red"> </td>
<td style="background-color:green"><div style="width: 30px;"> </div></td>
<td style="background-color:blue"> </td>
</tr>
<tr>
<td colspan="3" style="text-align:center">Some text here</td>
<td colspan="3" style="text-align:center">More text</td>
<td colspan="3" style="text-align:center">Hi</td>
<td colspan="3" style="text-align:center">Somewhat longer text</td>
</tr>
</table>
this might solve your answer, your previous code html elements are not properly closed look on that also.

Why one white space could make a new line? How to make the line with space(s) in one line

<table width="600">
<tbody>
<tr>
<td> <span>Price:</span> </td>
<td width="100%">
<table width="100%">
<tbody>
<tr>
<td style="width:100%;border-bottom:3px dotted #0b863c"> </td>
</tr>
</tbody>
</table>
</td>
<td>$30.9 sdfsdfd fgertwet</td>
</tr>
</tbody>
</table>
So I am trying to create a email template. It contains dynamic content with space. Every time when it has space inside the third column, it will create a new line. But I only want it to be in one line.
I know it works with white-space: no-wrap. However, white-space doesn't support in outlook -- https://www.campaignmonitor.com/css/. Any other ideas? Thanks!
See Expected:
<table width="600">
<tbody>
<tr>
<td> <span>Price:</span> </td>
<td width="100%">
<table width="100%">
<tbody>
<tr>
<td style="width:100%;border-bottom:3px dotted #0b863c"> </td>
</tr>
</tbody>
</table>
</td>
<td style="white-space: nowrap;">$30.9 sdfsdfd fgertwet</td>
</tr>
</tbody>
</table>
That is pretty much default behavior of text in HTML.
If you have control over the dynamic content, you could replace the spaces with non-breaking spaces ( ) as in the following example.
<table width="600">
<tbody>
<tr>
<td> <span>Price:</span> </td>
<td width="100%">
<table width="100%">
<tbody>
<tr>
<td style="width:100%;border-bottom:3px dotted #0b863c"> </td>
</tr>
</tbody>
</table>
</td>
<td>$30.9 sdfsdfd fgertwet</td>
</tr>
</tbody>
</table>

Table inside a table

I've added a table inside a table.
<tr>
<td colspan="10">
<table border="2" cellpadding="1" cellspacing="1">
<tr>
<td>col1 </td>
<td>col2</td>
</tr>
<tr >
<td >TEST </td>
<td >33444</td>
</tr>
<tr >
<td >TEST</td>
<td >9900</td>
</tr>
</table>
</td>
</tr>
But I want "TEST" values under col1 and numeric values under col2. Currently all values are shown under col1.
Edit - Actual Code
<tr>
<td colspan="10">
<table class='<%= "table"+count%>' style="display:none" border="2" cellpadding="1" cellspacing="1">
<tr>
<td>col1 </td>
<td>col2</td>
</tr>
<nested:iterate property="equipC" id="equipmentFormBean" indexId="ffIndex" >
<tr class='<%= "table"+count%> dataOff' style="display:none">
<td align="right" ><nested:write property="equipInitial" /> </td>
<td ><nested:write property="equipNum" /> </td>
</tr>
</nested:iterate>
</table>
</td>
</tr>
How to do it?
Use Google chrome...Your html code is right.On my PC I see the values are in COL2.
Use Forgot to use table heading heading tag "th"
<tr>
<td colspan="10">
<table border="2" cellpadding="1" cellspacing="1">
<tr>
<th>col1 </th>
<th>col2</th>
</tr>
<tr >
<td >TEST </td>
<td >33444</td>
</tr>
<tr >
<td >TEST</td>
<td >9900</td>
</tr>
</table>
</td>
</tr>
Your HTML code is correct. With the html provided by you it displayed the tables properly. You may please see it here # FIDDLE - http://jsfiddle.net/BRxKX/4986/
Problem could be with dynamic generation of tables and mostly around COLSPAN if at all its being used in your dynamic code.
Here is code that I tested (you can see this in - http://jsfiddle.net/BRxKX/4986/)
<html>
<head>
</head>
<body>
<table>
<tr>
<td colspan="10">
<table border="2" cellpadding="1" cellspacing="1">
<tr>
<td>col1 </td>
<td>col2</td>
</tr>
<tr >
<td >TEST </td>
<td >33444</td>
</tr>
<tr >
<td >TEST</td>
<td >9900</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>

How do I get a table with 3 columns and the third colums only has 1<td> 100%

<html>
<body>
<table align="left" border="0" cellpadding="1" cellspacing="1" style="width: 1000px;">
<tbody>
<tr>
<td width="300">Hanrathsingel 14</td>
<td width="300">Home</td>
<td width="400" height="100%">This one has to take the full height of the table</td>
</tr>
<tr>
<td width="300">1252 AE Laren</td>
<td width="300">Wie zijn wij</td>
</tr>
<tr>
<td width="300">T. 035-6231419</td>
<td width="300">Informatie</td>
</tr>
<tr>
<td width="300">M. 06-21700357</td>
<td width="300">Algemene Voorwaarden</td>
</tr>
<tr>
<td width="300">laren#qualitysites4all.com</td>
<td width="300">Contact</td>
</tr>
</tbody>
</table>
</body>
</html>
How do I get the column to be 100% of the table height but the other columns must keep their height?
Because I want to put a widget in there but I have to work in my boss his cms and I am not allowed to make new divs :(
Try rowspan:
<table align="left" border="0" cellpadding="1" cellspacing="1" style="width: 1000px;">
<tbody>
<tr>
<td width="300">Hanrathsingel 14</td>
<td width="300">Home</td>
<td width="400" rowspan="5">This one has to take the full height of the table</td>
</tr>
<tr>
<td width="300">1252 AE Laren</td>
<td width="300">Wie zijn wij</td>
</tr>
<tr>
<td width="300">T. 035-6231419</td>
<td width="300">Informatie</td>
</tr>
<tr>
<td width="300">M. 06-21700357</td>
<td width="300">Algemene Voorwaarden</td>
</tr>
<tr>
<td width="300">laren#qualitysites4all.com</td>
<td width="300">Contact</td>
</tr>
</tbody>
</table>
Example
JSFiddle Example
Use rowspan="5" in that TD.
Rowspan attribute, tells your element to "get the height" of 5 rows in this case.
If you have dinamic content remember to update this value to the actual number of rows of your table.

How to get rid of the border spacing using Graphviz HTML tables?

<table border="0" cellborder="1" cellpadding="5">
<tr>
<td colspan="2" align="left">d</td>
</tr>
<tr>
<td align="left" width="50">ct</td>
<td align="left">1</td>
</tr>
<tr>
<td align="left">wt</td>
<td align="left">0</td>
</tr>
</table>
The Graphviz output:
The expected output:
Try adding cellspacing="0" to your table tag
Also take a look at this: http://www.graphviz.org/doc/info/shapes.html#html