简体   繁体   English

在C#中使用Excel Interop向后兼容

[英]Backward compatibility using excel interop in C#

I am using an excel interop to open an excel file, edit and save it with some other name in some other location. 我正在使用excel互操作程序来打开excel文件,在其他位置使用其他名称对其进行编辑和保存。 For that I have used: 为此,我使用了:

workbook.saveAs(newFileName)

But it is prompting in the application for compatibility like how it is used to prompt while saving .xls file in office 2007. I have to click on continue in the front end application in order to continue. 但是它在应用程序中提示兼容性,例如在Office 2007中saving .xls文件时如何提示兼容性。我必须在前端应用程序中单击“继续”才能继续。 How can it be resolved? 如何解决?

Thanks in advance, Sarath 在此先感谢Sarath

There is an Application.DisplayAlerts property which you can set to False during your SaveAs operation (and then set back to True ). 有一个Application.DisplayAlerts属性,您可以在SaveAs操作期间将其设置为False (然后再设置回True )。

Here are the details: http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel._application.displayalerts(v=office.11).aspx 以下是详细信息: http : //msdn.microsoft.com/zh-cn/library/microsoft.office.interop.excel._application.displayalerts(v=office.11​​).aspx

... I'm not sure I 100% understand what it is you're experiencing, but if it's a notification box that appears, try putting this line before the Save command: ...我不确定我100%理解您正在经历什么,但是如果显示的是通知框,请尝试在“保存”命令前放置以下行:

ExcelApp.DisplayAlerts = False

That should disable the alert from popping up.... 那应该禁止警报弹出...。

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

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