C# Class exceltk.Clipborad.HTable2DataTable

http://blog.hypercomplex.co.uk/index.php/2010/05/parsing-html-tables-into-system-data-datatable/ HtmlTableParser parses the contents of an html string into a System.Data DataSet or DataTable.
Mostra file Open project: fanfeilong/exceltk

Public Methods

Method Description
ParseDataSet ( this htmlObj ) : DataSet

Given an HTML string containing n table tables, parse them into a DataSet containing n DataTables.

ParseTable ( string tableHtml ) : DataTable

Given an HTML string containing a single table, parse that table to form a DataTable.

Private Methods

Method Description
GenerateColumns ( MatchCollection rowMatches ) : DataColumn[]

For tables which do not specify header cells we must generate DataColumns based on the number of cells in a row (we assume all rows have the same number of cells).

ParseColumns ( string tableHtml ) : DataColumn[]

Given a string containing an HTML table, parse the header cells to create a set of DataColumns which define the columns in a DataTable.

ParseRows ( IEnumerable rowMatches, DataTable dataTable ) : void

Add a row to the input DataTable for each row match in the input MatchCollection

RemoveSpan ( this text ) : string
WithoutComments ( string html ) : string

Strip comments from an HTML stirng

Method Details

ParseDataSet() public static method

Given an HTML string containing n table tables, parse them into a DataSet containing n DataTables.
public static ParseDataSet ( this htmlObj ) : DataSet
htmlObj this An HTML string containing n HTML tables
return DataSet

ParseTable() public static method

Given an HTML string containing a single table, parse that table to form a DataTable.
public static ParseTable ( string tableHtml ) : DataTable
tableHtml string An HTML string containing a single HTML table
return DataTable