Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在编写一个 C# .NET 控制台应用程序。我需要将 a 的内容打印DataTable到打印机。我在网上找到的大多数解决方案都适用于 ASP.NET,而其他解决方案适用于基于 Windows 窗体的应用程序。欢迎任何代码碎片。
DataTable
好的...我在 MSDN 上找到了答案,因为我必须重新格式化代码,所以我提供了我的代码的链接。基本上,我将它粘贴到我的项目的实用程序类中,并将 static 关键字添加到 PrintFile 方法。