如何将WebDataGridview的数据导出到现有的Excel工作表?
我有一个 Webdatagridview,我想将其数据(不包括标题,因为我的 Excel 文件已经有标题)导出到我现有的 Excel 文件。
I have a Webdatagridview and i want to export the data of it(header not included because my excel file already have header) to my Existing Excel file.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
尝试:
try:
如果您使用的是 Infragistics WebDataGrid,则可以使用 WebExcelExporter 并使用 Export 方法,采用工作簿或工作表的实例。
为了防止出现标题,请在调用 Export 之前将要导出的 WebDataGrid 的 ShowHeader 属性设置为 false。请注意,这不需要设置回 true,因为响应已更改为将 Excel 文件发送到客户端,因此没有针对此请求发送到客户端的网格的状态信息。
If you are using the Infragistics WebDataGrid, you can use the WebExcelExporter and use an overload for the Export method that takes and instance of a workbook or worksheet.
For preventing the headers set the ShowHeader property of the WebDataGrid that you are exporting to false before calling Export. Note that this will not need to be set back to true since the response is being changed to send the excel file to the client so there is no state information for the grid sent to the client for this request.