简体   繁体   English

如何使用Visual Studio项目资源中的Excel文件

[英]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 :-( 我将一个excel文件添加到我的项目资源中,我想打开它,但是方法woorkobook.open()仅将路径字符串作为参数:-(

What is the proper way to open and use those excel files from resource? 打开和使用资源中的那些excel文件的正确方法是什么?

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

Office applications are before the time of .NET Streams. Office应用程序早于.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)

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

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