求助,关于DevExpress GridView导出到Excel的问题!!!!
设置了CustomColumnDisplayText事件后,GridView导出的数据到Excl是自定义后的数据 ,如何才能导出原始数据?protected void ASPxGridView1_CustomColumnDisplayText(object sender, ASPxGridViewColumnDisplayTextEventArgs e)
{
for (int i = 0; i < ASPxGridView1.VisibleRowCount; i++)
{
if (e.Column.FieldName == "品名")
{
var v_hash = new Hashtable();
v_hash.Add("p1", e.GetFieldValue("入库单id"));
v_hash.Add("p2", Q_入库日期_1.Date.ToString("yyyy-MM-dd"));
v_hash.Add("p3", Q_入库日期_2.Date.ToString("yyyy-MM-dd"));
v_hash.Add("p4", e.GetFieldValue("数量1"));
v_hash.Add("p5", e.GetFieldValue("金额2"));
string v_str = "<a href='库存台账明细.aspx?%s'>%s<a>";
v_str = Common.FormatEh(v_str,
CommonWebUtil.GetUrlParams(v_hash), e.GetFieldValue("品名"));
e.DisplayText = v_str;
}
}
}
public static void GridExport(string fileName, ASPxGridViewExporter gridExporter)
{
XlsExportOptions ExportOptions = new XlsExportOptions
{
ExportMode = XlsExportMode.SingleFile,
SheetName = "Sheet1",
ShowGridLines = true,
TextExportMode = TextExportMode.Text
};
gridExporter.WriteXlsToResponse(fileName, true, ExportOptions);
}
protected void ASPxMenu1_ItemClick(object source, MenuItemEventArgs e)
{
switch (e.Item.Text)
{
case "查询":
LoadData();
return;
case "清空查询":
CommonWebUtil.清空查询(div查询);
return;
case "导出":
LoadData();
CommonWebUtil.GridExport("库存台账", ASPxGridViewExporter1);
return;
}
} devexpress GridView Excel --------------------编程问答--------------------
ExportOptions.UseNativeFormat = true;
2货安瑞拿分来
补充:.NET技术 , ASP.NET