开发者

How to print datagridview results?

开发者 https://www.devze.com 2023-03-29 22:03 出处:网络
How can I get a hardcopy print of the results shown开发者_开发问答 in datagridview?You will have to use the DrawToBitmap function to save a snapshot of the DataGridView to a bitmap and then print that

How can I get a hardcopy print of the results shown开发者_开发问答 in datagridview?


You will have to use the DrawToBitmap function to save a snapshot of the DataGridView to a bitmap and then print that bitmap.

OR

You will have to write a function that ouputs the DataSource (DataTable, DataSet, etc..) to a text file or directly to a printer. Here are some examples:

Printing a DataTable to textbox/textfile in .NET

print gridviews, datagrids, or datatables


Since the DataGridVeiw is a reflection of a DataSet you can use DataSet.WriteXml(XmlFileName.xml) With this you can export the entire dataSet with all the tables in a XML File. YOu can then print this file !


Printing in Dot net can be either really easy by using the Crystal Report Document, or tedious through the print document. For a simple table, use Crystal. You can pass a data adapter directly to it.


It's really easy to output as csv and then print it from Excel.

export Datagrid to excel asp

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号