简体   繁体   English

将PPT转换为PDF时出错

[英]Error while converting PPT to PDF

I am trying to make a application which converts docx/xls/ppt to pdf. 我正在尝试制作将docx / xls / ppt转换为pdf的应用程序。

  1. Conversion of docx and xls requires Microsoft.Office.core dll docx和xls的转换需要Microsoft.Office.core dll
  2. Conversion of ppt requires Office.dll ppt转换需要Office.dll

I successfully converted 1 and 2 separately but when i try to merge both of them ie 我成功地分别转换了1和2,但是当我尝试合并它们两个时

when i try to add both the reference (Microsoft.Office.core dll and Office.dll) together it gives me error. 当我尝试将两个引用(Microsoft.Office.core dll和Office.dll)加在一起时,它给了我错误。

so, is there any problem in adding both the dll's ? 因此,添加两个dll是否有任何问题?

229 error of same Kind ---- Error 1 Cannot embed interop type 'Microsoft.Office.Core.MsoBlogImageType' found in both assembly 'e:\\All Pdf\\waterMark_PDF\\PDF Merger and Protector Source Code\\PDFMerger\\obj\\Debug\\Interop.Microsoft.Office.Core.dll' and 'c:\\Program Files\\Microsoft Visual Studio 10.0\\Visual Studio Tools for Office\\PIA\\Office12\\Office.dll'. 229相同类型的错误----错误1无法嵌入在程序集'e:\\ All Pdf \\ waterMark_PDF \\ PDF合并和Protector源代码\\ PDFMerger \\ obj \\ Debug \\中找到的互操作类型'Microsoft.Office.Core.MsoBlogImageType' Interop.Microsoft.Office.Core.dll”和“ c:\\ Program Files \\ Microsoft Visual Studio 10.0 \\ Visual Studio Tools for Office \\ PIA \\ Office12 \\ Office.dll”。 Consider setting the 'Embed Interop Types' property to false. 考虑将“嵌入互操作类型”属性设置为false。

Note - i had changed "Embed Interop Types" property to false for both dll's. 注意-对于两个dll,我都将“嵌入互操作类型”属性更改为false。

please help. 请帮忙。

Just use the specific libraries: 只需使用特定的库:

using Excel = Microsoft.Office.Interop.Excel;
using Word = Microsoft.Office.Interop.Word;
using Power = Microsoft.Office.Interop.PowerPoint;

They should have everything you need along with not having namespace isssues between interlocking dll's 它们应该具有您所需的一切,并且在互锁的dll之间没有命名空间问题

These are found as COM references 这些可以作为COM引用找到

EDIT: Also, are you using correct namespaces? 编辑:另外,您是否使用正确的名称空间? If you could post some code it would be helpful. 如果您可以发布一些代码,将很有帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM