Excel自动化另存为破坏文件 [英] Excel Automation Save As ruins the File

查看:108
本文介绍了Excel自动化另存为破坏文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


oWB.SaveAs(Filename:="C:\target\Testxls", FileFormat:=Excel.XlFileFormat.xlCSV)


这是保存创建的Excel文件的方式,但是当我检查文件时,格式被破坏了吗? :(

如何避免呢?

谢谢.


This is how I save the Excel file I created, but when I checked the file, the formatting is ruined? :(

How can I avoid it?

Thanks.

推荐答案

您正在SaveAs方法中指定Comma Separated Value格式.该格式不能存储Excel文件的格式信息.您可以从此处提供的列表中选择一种适合您要求的格式
http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.xlfileformat.aspx [ ^ ]
You are specifying Comma Separated Value format in the SaveAs method. This format cannot store the format information of excel file. You can choose one of the formats, which suits your requirement, from the list given here
http://msdn.microsoft.com/en-us/library/microsoft.office.interop.excel.xlfileformat.aspx[^]


这篇关于Excel自动化另存为破坏文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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