带有办公文档的asp.net [英] asp.net with office documents

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

问题描述

如何打开办公室文件,例如。网页浏览器上的.doc,.ppt文件

我尝试了但是那些文件下载了

我不想下载文件只需在网页上打开它

是否有任何API

how to open office documents eg. .doc, .ppt files on web browser
I tried it but those file get downloaded
I dont want to download file just open it on web page
is there any api for that

推荐答案

只是合乎逻辑:在客户端,用户只能通过浏览器看到该网站。在一般情况下,用户没有任何支持office文件的软件,这些文件是专有的。这些天,有这些文件格式的标准,但它并没有改变这种情况:用户的计算机不支持它们。



但是,服务器端,这取决于。你可以支持他们。但当然,忘了我不想下载。很明显,不是吗?

由于我上面解释的原因,你无法直接呈现办公室文件。有许多站点支持office文件。应模拟内容的呈现。通常,使用HTML。







Just be logical: on a client side, the user can only see the site through the browser. In general case, the user don''t have any software supporting office files, which are proprietary. These days, there are standards for those file formats, but it does not change the situation: the users'' computers don''t support them.

But, on server side, it depends. You can support them. But of course, forget "I don''t want to download". Obvious, isn''t it?
And you cannot present office files directly, by the reason I explained above. There is a number of sites which support office files. The presentation of the content should be simulated. Usually, with HTML.



Tushar Vayangankar问:
Tushar Vayangankar asked:

什么是Microsoft.Office.Interop,它是如何工作的?

What is Microsoft.Office.Interop, how it works?

当您安装Microsoft Office时,除了别的以外,您还有主要的 Microsoft .Office.Interop 安装在本地系统的GAC(全局程序集缓存)中的程序集。您可以引用这些程序集并使用它们来创建,打开和修改Office文档。



此外,这些程序集可以重新分发;例如,请参阅 http://www.microsoft.com/en-us/download/ details.aspx?id = 3508 [ ^ ]。



要引用程序集,因为它们强名称并安装在GAC中,您需要用名字来引用它们。因此,在Visual Studio中,您可以从添加引用窗口的.NET选项卡中添加引用。程序集名称为 Microsoft.Office.Interop.Word Microsoft.Office.Interop.Excel Microsoft.Office.Interop.PowerPoint ,依此类推。每个这样的程序集都有不同的版本,具体取决于安装的Office和.NET Framework的版本。



请参阅,例如:

http://msdn.microsoft.com/ en-us / library / microsoft.office.interop.excel%28v = office.11​​%29.aspx [ ^ ],

http://msdn.microsoft.com/en-us/library/microsoft.office.interop.word。 aspx [ ^ ]。



你会在每个Office产品上找到这样的MSDN帮助页面。



原则上,有第三方产品与Offi合作ce文件,这将允许您在不安装Microsoft Office的情况下工作。如果您有兴趣,我可以建议参考,或者您也可以在可用的CodeProject答案中找到它们。



-SA

When you install Microsoft Office, among other things, you got primary Microsoft.Office.Interop assemblies installed in the GAC (Global Assembly Cache) of your local system. You can reference those assemblies and used them to, basically, create, open and modify Office Documents.

Also, these assemblies can be redistributed; see for example, http://www.microsoft.com/en-us/download/details.aspx?id=3508[^].

To reference the assemblies, as they are strongly named and installed in GAC, you need to reference them by names. So, in Visual Studio, you add a reference from the ".NET" tab of the "Add Reference" window. The assembly names are, Microsoft.Office.Interop.Word, Microsoft.Office.Interop.Excel, Microsoft.Office.Interop.PowerPoint, and so on. Each such assembly comes in different versions, depending of the versions of Office and .NET Framework installed.

Please see, for example:
http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel%28v=office.11%29.aspx[^],
http://msdn.microsoft.com/en-us/library/microsoft.office.interop.word.aspx[^].

You will find such MSDN help pages on every Office product, separately.

In principle, there are 3rd-party products working with Office files, which would allow your to work without installation of Microsoft Office. If you are interested, I can advise the references, or you also can find them in available CodeProject answers.

—SA


您无法直接在网络浏览器中显示powerpoint文档本身。但是,您可以做的是将powerpoint演示文稿的每张幻灯片转换为图像,然后在客户端上以幻灯片形式显示图像。
You can''t show a powerpoint document directly in a web browser natively. What you can do, however, is convert each slide of the powerpoint presentation to an image and then display the images as a slideshow on the client.


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

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