如何将HTML文件内容复制到XLSX文件? [英] How to copy HTML file content to a XLSX file?
问题描述
我可以使用此方法[File.Copy()]正确地将HTML文件内容复制到XLS文件.但是,当我将HTML文件内容复制到XLSX文件时,我观察到它能够正确复制所有数据,但是这使此XLSX文件受到限制.因此,它不能在EXCEL 2007中打开.
但是,如果我们手动将相同创建的XLSX文件的格式更改为XLS,则它可以在OFFICE 2007中打开(格式为正式警告消息,其格式为较低版本).
我知道 .xlsx文件是作为2007 Office应用程序使用的ZIP包严格打开的.所以,我觉得没有任何简单的方法可以从HTML文件创建好的XLSX文件.在C#中.
因此,如果有其他方法可以创建此XLSX文件,请指导我.
Hi,
I''m able to copy HTML file content to a XLS file using this method[File.Copy()]properly. But while i''m copying HTML file content to a XLSX file, i observed its able to copy all data properly ,but its making this XLSX file curropted. SO its not able open in EXCEL 2007.Getting error as its a curropted file.
But if we manualy change the foramt of the same created XLSX file to XLS , then its able to open in OFFICE 2007(with a formal warning message as its a lower version formated).
I came to know an .xlsx file is opened strictly as a ZIP package used by 2007 office applications.So i don''t feel there is any easy way to create a good XLSX file from a HTML file in C#.
So kindly please guide me if any different way to create this XLSX file.
推荐答案
您不能. XLSX文件实际上是一个.ZIP文件,其中包含许多文件.不相信我吗?提取任何.XLSX文件并将文件扩展名重命名为.ZIP.在WinZip或资源管理器中将其打开,然后在其中查看.
You can''t. An XLSX file is really a .ZIP file with a bunch of files inside. Don''t believe me? Take any .XLSX file and rename the file extension to .ZIP. Open it in WinZip or Explorer and peek inside.
这篇关于如何将HTML文件内容复制到XLSX文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!