M
M
Maxmyd2011-12-20 14:01:01
css
Maxmyd, 2011-12-20 14:01:01

Creating an HTML table layout?

Hello.
I have a dataset, for each field its position in the table is written - the X and Y coordinates indicating the position of the cell in the table, as well as Rowspan and Colspan, indicating you know what. Can anyone suggest an algorithm by which I can create an HTML table with all colspans and rouspans? The size of the table in "absolute" cells and rows is known in advance, you just need to create a cell layout.
Thanks in advance.
UPD. Here's what the layout data will look like. Of course, this will not be in JSON, it just seemed to me that it would look easier this way. As a result, the following code should be transformed into a valid table, and I took it from there :)

{<br/>
row : { <br/>
 cell : { x: 0, y: 0, colspan: 2, rowspan: 1}, <br/>
 cell : { x: 2, y: 0, colspan: 1, rowspan: 1}<br/>
 },<br/>
row : { <br/>
 cell : { x: 0, y: 1, colspan: 2, rowspan: 3}, <br/>
 cell : { x: 1, y: 1, colspan: 2, rowspan: 1}, <br/>
 cell : { x: 2, y: 1, colspan: 2, rowspan: 2}<br/>
 },<br/>
row: {<br/>
 cell : { x: 1, y: 2, colspan: 1, rowspan: 1}<br/>
 },<br/>
row: {<br/>
 cell : { x: 1, y: 3, colspan: 1, rowspan: 1},<br/>
 cell : { x: 2, y: 3, colspan: 1, rowspan: 1}<br/>
 },<br/>
row: {<br/>
 cell : { x: 0, y: 4, colspan: 3, rowspan: 1}<br/>
 } <br/>
}

UPD2. The task is not to create text markup, according to which the table will be rendered. The task is to create a control in ASP.NET that will contain an object representing a table and inheriting HtmlControl. And in this object there will be cells containing other controls. And all this will be rendered regularly using ASP.NET.
PS Correctly asked question, pancake, contains half of the answer. I apologize for the unspoken thoughts :(

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2011-12-20
Protko @Fesor

Reminds the structure of an XSLX file. I can’t think of something right off the bat, it would be nice if you gave an example of a data array.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question