简体   繁体   中英

How to use Excel file from visual studio project resource

I add an excel file to my project resource, and I would like to open it, but method woorkobook.open() take only path string as parameter :-(

What is the proper way to open and use those excel files from resource?

在VS中,如果将添加到项目中的excel文件的“复制到输出目录”属性设置为“始终复制”,则可以直接使用文件名作为路径值。

Office applications are before the time of .NET Streams. The applications only work with physical files. You must copy the resource to a physical file or use a third-party component.

        Dim sPath As String = My.Computer.FileSystem.GetTempFileName
        My.Computer.FileSystem.WriteAllBytes(sPath, My.Resources.us, False)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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