DataTable匯出到word或excel

2021-06-16 17:11:52 字數 1379 閱讀 9791

using system;

using system.data;

using system.configuration;

using system.collections;

using system.web;

using system.web.security;

using system.web.ui;

using system.web.ui.webcontrols;

using system.web.ui.webcontrols.webparts;

using system.web.ui.htmlcontrols;

using system.drawing;

using system.io;

using system.text;

///

/// author:匆匆  blog:

/// 將gridview中的資料匯出excel**

///

public partial class gridviewexcel : system.web.ui.page

}///

/// 資料繫結

///

public void bind()

;gridview1.databind();

}///

/// 在 gridview 控制項中的某個行被繫結到乙個資料記錄時發生。此事件通常用於在某個行被繫結到資料時修改該行的內容。

///

///

///

protected void gridview1_rowdatabound(object sender, gridviewroweventargs e)

if (e.row.rowindex != -1)

}///

/// 匯出excel

///

///

///

protected void button1_click(object sender, eventargs e)

///

/// 定義匯出excel的函式

///

///

///

private void export(string filetype, string filename)

///

/// 此方法必重寫,否則會出錯

///

///

public override void verifyrenderinginserverform(control control)

protected void button2_click(object sender, eventargs e)

}

GridView匯出到Excel或Word檔案

前台頁面 後台 using system using system.data using system.configuration using system.collections using system.web using system.web.security using system.web...

GridView匯出到Excel或Word檔案

前台頁面 gridview匯出到excel或word檔案 周公的部落格 http blog.csdn.net title head body form id form1 runat server div asp gridview id gvpersonlist runat server autoge...

GridView匯出到Excel或Word檔案

前台頁面 gridview匯出到excel或word檔案 周公的部落格 http blog.csdn.net title head body form id form1 runat server div asp gridview id gvpersonlist runat server autoge...