Drawing tables -
11-12-2007
, 12:39 PM
Hi,
I was working on a report over the weekend and needed to draw a table with
text in the cells. I managed to get it done, but the code is ugly and I'm
not happy about how fragile it is.
I planned on creating some classes to render a table, something like:
<code>
DocumentTable table = new DocumentTable(float width);
TableColumn column = table.AddColumn("Heading Text", float width);
TableColumn column = table.AddColumn("Heading Text 2", float width);
TableRow row = table.AddRow();
row.Cells[0].Text = "Text in the first cell";
row.Cells[1].Text = "Text in the second cell";
table.Draw(Graphics g);
</code>
Obviously it would be much more involved than that, but this is just an
example. The more I think about creating this table drawing class the more
I'm realizing how much work it will be! So I thought I would check here and
find out if any of you know of any open source projects, Code project
classes, etc that does something like this?
I'll create my own if I have to, but it would be much more efficient if I
could find something that's already created and extend (or contribute) to
it.
Thanks,
Steve |