asp.net中的Excel问题 [英] Excel problem in asp.net

查看:78
本文介绍了asp.net中的Excel问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友
iam在excel中导入数据,我的代码是

hello friends
iam importing data in excel ,my code is

string attachment = "attachment; filename=Sheet1.xls";
              Response.ClearContent();
              Response.AddHeader("content-disposition", attachment);
              Response.ContentType = "application/vnd.ms-excel";



它正在导入,但是我想设置自动换行属性,该怎么办?



it is importing fine but i want to set word wrap property, how can i do that

推荐答案

如果要从gridview导出数据,请使用以下

在导出按钮上单击事件

If you are exporting the data from gridview then use the following

On Export Button Click Event

//Before exporting you can wrap the words by making cell.wrap = true

  For Each Row In GridView1.Rows
      For Each Cell In Row.Cells
       Cell.Wrap = True
      Next
    Next


这篇关于asp.net中的Excel问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆