以编程方式从VSTO Excel工作簿中读取_AssemblyLocation

时间:2022-02-21 20:42:26

I've got a Visual Studio Excel Workbook project. When I publish the workbook and examine the source of the workbook (I open WinZip and check custom.xml), I see the tag _AssemblyLocation, which corresponds to the publish path.

我有一个Visual Studio Excel工作簿项目。当我发布工作簿并检查工作簿的来源(我打开WinZip并检查custom.xml)时,我看到标签_AssemblyLocation,它对应于发布路径。

Is there a way to read _AssemblyLocation from my .NET code?

有没有办法从我的.NET代码中读取_AssemblyLocation?

I'd like to be able to read the publish path and determine which environment (development/quality assurance/production) I'm in based on server name.

我希望能够阅读发布路径并根据服务器名称确定我所处的环境(开发/质量保证/生产)。

2 个解决方案

#1


I guess you could open the xlsx using the ZipPackage class then read the XML using Xquery or xlinq etc.

我想你可以使用ZipPackage类打开xlsx然后使用Xquery或xlinq等读取XML。

http://msdn.microsoft.com/en-us/library/system.io.packaging.zippackage.aspx

#2


The blog post, "How to get the Custom Properties of a Word Document using VSTO", provides a solution

博客文章“如何使用VSTO获取Word文档的自定义属性”提供了一种解决方案

#1


I guess you could open the xlsx using the ZipPackage class then read the XML using Xquery or xlinq etc.

我想你可以使用ZipPackage类打开xlsx然后使用Xquery或xlinq等读取XML。

http://msdn.microsoft.com/en-us/library/system.io.packaging.zippackage.aspx

#2


The blog post, "How to get the Custom Properties of a Word Document using VSTO", provides a solution

博客文章“如何使用VSTO获取Word文档的自定义属性”提供了一种解决方案