创建没有microsoft interop dll的Doc文件 [英] Create Doc file without microsoft interop dll

查看:99
本文介绍了创建没有microsoft interop dll的Doc文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我想使用c#创建没有microsoft interop dll的Doc文件。



有没有第三方dll或其他方式?



谢谢

解决方案

是的,有,如果你同意.docx,甚至不一定是第三方。



首先,避免使用Office是一个好主意互操作。请参阅此微软文章,警告您: http://support.microsoft。 com / default.aspx?scid = kb; EN-US; q257757 #kb2 [ ^ ]。



或者,您可以使用Microsoft Open XML SDK:



http:// www。 microsoft.com/en-us/download/details.aspx?id=30425 [ ^ ]。



这样,您可以支持新的基于XML的Office格式(例如as .DOCX,.XLSX),ECMA-376标准:

http://en.wikipedia.org / wiki / Microsoft_Office_XML_formats [ ^ ],

http ://en.wikipedia.org/wiki/Office_Open_XML [ ^ ]。



此外,第三方软件支持这些文件。请查看我过去的答案:

将Office文档转换为PDF而不互操作 [ ^ ],
需要一个相当独特的WPF文本编辑器控件 [ ^ ],

您好如何使用c#.net 在Windows应用程序中显示word文件[ ^ ],

阅读没有使用Interop.word dll的word文件...不想在IIS中安装单词。 [ ^ ]。



这是另一种选择: http://npoi.codeplex.com/ [ ^ ]。



-SA


取决于您想要的doc类型要创建,您可以使用免费并由MS人员制作的ReportViewer RDLC报告格式。您可以创建RDLC报告,然后使用您想要的任何内容填充它,并通过代码将其导出为Word doc格式。以下是使用Microsoft报告导出到Word / PDF的示例代码( RDLC),不使用报告查看器。 [ ^ ]



同样,所有这些都取决于您要创建的文档类型,但它是一个不错的选择。 HTH

Hi,

I want to create Doc file without microsoft interop dll using c#.

is there any 3rd party dll or other way of doing so??

thanks

解决方案

Yes, there is, and, if you would agree on .docx, not even necessarily 3rd-party.

First of all, this is a good idea to avoid using the Office interop. Please see this Microsoft article warning you about it: http://support.microsoft.com/default.aspx?scid=kb;EN-US;q257757#kb2[^].

Alternatively, you can use Microsoft Open XML SDK:

http://www.microsoft.com/en-us/download/details.aspx?id=30425[^].

This way, you can support new XML-based Office formats (such as .DOCX, .XLSX), ECMA-376 standard:
http://en.wikipedia.org/wiki/Microsoft_Office_XML_formats[^],
http://en.wikipedia.org/wiki/Office_Open_XML[^].

Also, the documents are supported by 3rd-party software. Please see my past answers:
Convert Office-Documents to PDF without interop[^],
Need a rather unique WPF text editor control[^],
Hi how can i display word file in windows application using c#.net[^],
Read a word file without using Interop.word dll...Do not want to install word in IIS..[^].

This is another option: http://npoi.codeplex.com/[^].

—SA


Depending on the doc type you want to create, you can use ReportViewer RDLC report format which is free and made by MS guys. You can create a RDLC report and then fill it with whatever you want and export it to Word doc format through code. Here is a sample code Exporting to Word/PDF using Microsoft Report (RDLC) without using Report Viewer.[^]

Again, all depend on what kind of document you want to create but it is a good alternative. HTH


这篇关于创建没有microsoft interop dll的Doc文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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