如何在Asp.net页中打开Excel [英] How to open Excel in Asp.net page

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

问题描述



我想在C#.net页面中使用excel,用户可以在excel中插入数据,但是在插入之前,用户可以设置要插入的行数和列数.当用户插入数据时,该数据会自动保存在数据库中,并使用Sql Server To将数据保存在数据库中

除了插入,用户还可以执行其他操作,例如删除/更新/选择.

请帮我解决这个问题.

谢谢
Twinkle Kumar

Hi,

I want excel in C#.net page in which user can insert data in excel but before insertion user set how many number of rows and colums he want to insert.When user insert data, that data automatically save in database and i m using Sql Server To save data in database

Along with insertion, user can do other operations like delete/update/select.

Please help me to solve this problem.

Thanks
Twinkle Kumar

推荐答案

您需要考虑一下这里将要发生的事情,您要的不是真的可行

Excel是一个程序&为了使用户能够与之交互,必须将其安装在他们的计算机上.您无法真正从网页上控制客户端上的Excel,这将是一个巨大的安全漏洞. (注意:您可以做一些事情,但是必须明确地允许它并设置权限.最好是忘了imo)

您真正想要做的是以类似于网格的格式显示数据,并提供客户端功能以将数据保存到数据库之前.为此,类似于 GridView 组件的组件非常适合您的需求.

看看GridView

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.aspx [ ^ ]
You need to think a bit about what will happen here, what you''re asking for isn''t really feasable

Excel is a program & for the user to be able to interact with it, it must be installed on their computer. You can''t really control Excel on the client from web pages, that would be a massive security hole. (NB: There''s a certain amount you can do, but it has to be explicity allowed and permissions set. Best just to forget about it imo )

What you actually want to do is display data in a grid like format and offer the client functionality to work with data before persisting it to the database. For this, something like the GridView component is perfect for your requirements.

Have a look into GridView

http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.aspx[^]


我已经使用Gridview了所有选项,例如编辑/删除/更新"以及取消".但是现在我所有工作都以Excel格式进行.这可能与否.

请给我一些想法

谢谢
I m Already used Gridview With All options Like Edit / Delete / Update and as well as Cancel. but now i m all things do in Excel Format . This is Possible Or not .

Please Give me some idea

Thanks


没有办法做你所追求的.
Excel是专有产品,并且不用于一般Web.

您还必须为访问您网站的每个人都拥有一个许可证.

您需要的是一个Datagrid,并将该数据馈送到数据库中.
(如果需要功能,可以将其输入电子表格中,但仅供您自己使用.
There is no way of doing what you are after.
Excel is a proprietry product, and it is not set of general web use.

You would also have to have a license for every single person who went to your website.

What you need is a Datagrid, and feed that data into a database.
(If you need functionality, it can be fed into a spreadsheet, but only for your own use.


这篇关于如何在Asp.net页中打开Excel的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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