如何打印 WinForm 中的 DataGridView?
如题,谢谢
------解决方案--------------------mark.
------解决方案--------------------导到EXCEL打印
------解决方案--------------------不是要求直接吧
------解决方案--------------------参考:www.codeproject.com/csharp/PrintDataGridView.asp
------解决方案--------------------水晶报表
------解决方案--------------------导到EXCEL打印
添加控件office web Components
using Microsoft.Office.Interop.Owc11;
FileInfo f;
SpreadsheetClass ex1 = new SpreadsheetClass();
Worksheet ws = ex1.ActiveSheet;
foreach(DataRow row in gridDataSet.Tables[0])
{
ws.Cells[i, 1] = row[0];
ws.Cells[i, 2] = row [1];
..................
}
try
{
ex1.Export(@ "C:\ExportSize.xls ", SheetExportActionEnum.ssExportActionOpenInExcel, SheetExportFormat.ssExportXMLSpreadsheet);
}