HTML Table Generator

Friday Dec 17th 1999 by Kim Pil Ho

Very nice application that generates HTML for graphically created tables

Environment: VC6 SP3, NT4 SP5

HTMLTableGen.gif (29721 bytes)

During my project, I made HTML table generator. Currently, I developed only 2 HTML subset classes, Button & Table what I need at my report report form.
HTML Table Generator class can be used in various way. In case of me, I make this class for simulation result form. If I make result form table with grid or other way, I have to worry about print, separate page, view class, scroll etc.. Theses burden make me decide to make HTML table generator which can solve all problems and my program users like this HTML result form. :-)


How can I use this HTML Table Generator?

1. Include HtmlFile.h, HtmlFile.cpp, HtmlTable.h, HtmlTable.cpp to your project.
   Make Style directory and Put HtmlFile.dat file at Style directory.

2. Define CHtmlFile variable and create HTML file with CreateHtmlFile()

	CHtmlFile m_HtmlFile;
	CHtmlTable *pButton, *pTable;

	// Create Html File
	m_HtmlFile.CreateHtmlFile(_T(result\\result.htm), _T(Simulation Result));

3. Add Button or Table to HtmlFile

    In case of Button, I didn't make text file but do all job at source code.

	pButton = new CHtmlTable();
	pButton->m_iTableType = HTML_TABLE_BITMAP;
	pButton->m_iColumn = 2;
	pButton->m_iRow = 1;
	pButton->m_iFixedRow = 0;
	pButton->m_iFixedColumn = 0;
	pButton->m_iWidth = 50;

	// Write Header Data



	// Write Table Data

	delete pButton;

    In case of data Table, You can use text file in a data table format.
    This means your program have to write data file in data table format

	pTable = new CHtmlTable();
	delete pTable;

4. Write HTML File


Defined Table Type

Constant Value Comment
HTML_TABLE_GRAY 0 1 fixed column with gray background color
HTML_TABLE_WHITE 1 no border, all white
HTML_TABLE_GRAYBAND 2 1 fixed column with gray, 1 fixed row with gray
HTML_TABLE_GRAY2BAND 3 1 fixed column with gray, 1fixed row with gray, 1fixed row with dark gray & colored text
HTML_TABLE_DARKGRAYBAND 4 1 fixed column with gray, 1 fixed row with dark gray
HTML_TABLE_BITMAP 5 no border, figure buttons in 1 row


Data Table Format

Mill Edger Train // You can ignore title
3		// Table Type
9		// Table column number include fixed column
7		// Table Row include fixed row
1		// Fixed row
2		// Fixed column
100		// Table width percentage (%)
[DATA]		// All data should be separated with comma
Pass,Mill No.,HRatio (%),Height (mm),dH (mm),EtaH (%),dWh (mm),Temperature (!I),Angle (!F),
1,4Mill 1,0.100,208.32,20.78,0.0887,4.61,1240.69,10.07,
2,4Mill 1,0.161,175.69,33.45,0.1567,8.02,1235.14,12.78,
3,4Mill 1,0.177,139.82,36.78,0.2043,9.06,1227.70,13.40,
4,4Mill 2,0.385,96.17,44.77,0.3125,11.63,1204.26,15.38,
5,4Mill 2,0.335,58.14,38.95,0.3955,10.41,1194.53,14.34,
6,4Mill 2,0.280,26.42,32.56,0.5469,11.06,1150.69,13.11,

Style File Format

Htmlfile.dat file has my favorite HTML file and HTML table style. I'm sorry about Style file is not in easy format but  It isn't difficult so much.

HtmlFile.dat has 1 HTML body and several Table body. You can change all HTML code as you like but leave strings in a ^text^ format unchanged!! A string within ^ bracket is keyword used by CHtmlFile or CHtmlTable.

Keyword used at Htmlfile.dat

Keyword Comment
^BODY^ Used By CHtmlFile, All Table or Bitmap data will be inserted at here
^TABLETITLE^ Table title defined at data table format or bitmap button title will be inserted here
^HEIGHT^ Table Height
^WIDTH^ Table Width
^DATA^ Data


^BOTTOM_SOLID^ CHtmlTable check cell boundary and deicde whether to draw cell outline or not
^ADDRESS^ Button address will be inserted here

Anybody feel free contact with me and enhance this code. If you enhance this code, don't hesitate to report at codeguru. Good Luck :-)


Download demo project - 53 Kb
Download source - 7 Kb
Mobile Site | Full Site
Copyright 2018 © QuinStreet Inc. All Rights Reserved