ExtendedDataTable is a component which provides more functionality compared to native .NET Framework DataTable. It is also platform independent, you can use it with Web or Windows applications. It is developed by .NET Framework 2.0 and .NET Framework 3.5, you can download both versions from this page. Let's look at what functionalities
It always takes time for developers writing code to export data to external file types such as Word, Excel, HTML. Developers also spending time for some actions such as printing a report, sending a mail. This is a time saving component which gives the benefit to developers to use these functionalities quickly.
Using the Code
ToWord: Exports the data into a Word document in client's computer as a table object
ToExcel: Exports the data as Excel worksheet in client's computer
ToHtml: Generates the HTML code using
td tags that represent data
SendMail: Allows users to send the HTML table that represents data as email
Print: Prints the data to any printer
Fill: Easily fills table with data from database with the
DataAdapter component it includes
Update: Allows users to easily update data to database with
DataAdapter component it includes
StyleProperties: You can easily modify the style of the table which will be generated, such as Table Style, Row Style, Header Style, Alternating Row Style, Row Specific Style by this property.
FormatProperties: This property allows users to change the format of the table which will be generated, such as Column Headers, Column Alignments and Column Formats (number, date formats).
PrintProperties: By using this property, you can easily modify the layout of the document which will be printed or the properties of the printer.
MailProperties: This property is used to change the settings for SMTP Server.
DataProperties: This property allows users to modify the settings for
DataAdapter components to fill or update data.
Let me explain the technology that is used to provide these functionalities:
ToExcel methods Office Interop is used to create and fill the documents.
ToHtml is a simple method that generates the HTML code using
table tags by iterating through rows and columns.
SendMail creates a
MailMessage object and sends the HTML code generated by SmtpServer.
Print method works differently for Windows and Web applications:
- For Windows applications, it uses
Graphic objects methods like
DrawString for generating the document to be printed.
- For Web applications, it writes generated HTML code to current response and calls
Update methods uses
update data to database.
You can find information about how to use this component in a sample application provided in the download.
ExtendedDataTable extendedDt = new ExtendedDataTable();
DataSet ds = new DataSet();
DataTable dt = ds.Tables;
extendedDt.FormatProperties.ColumnNames["FriendId"] = "Id";
extendedDt.FormatProperties.ColumnNames["FriendName"] = "Name";
extendedDt.FormatProperties.ColumnNames["FriendSurname"] = "Surname";
extendedDt.FormatProperties.ColumnNames["Gender"] = "Gender";
extendedDt.FormatProperties.ColumnNames["PlayedBy"] = "Played By";
extendedDt.MailProperties.SmtpClient.Host = "localhost";
extendedDt.SendMail("email@example.com", "firstname.lastname@example.org", "Friends");
extendedDt.PrintProperties.PrintDocument.DefaultPageSettings.Landscape = true;
"data source=.;initial catalog=dummy;integrated security=SSPI";
extendedDt.DataProperties.Command.CommandText = "SELECT * FROM Dummy";
- Initial release: 19.01.2008 V 1.0.0
For bug reports and suggestions, feel free to contact me at email@example.com.