【问题标题】:Programmatically change the sheet name of a Excel File以编程方式更改 Excel 文件的工作表名称
【发布时间】:2012-02-03 05:39:36
【问题描述】:

使用 VB.net 更改新创建的 .xls 文件的工作表名称的最简单方法是什么。

.xls 在目录位置创建如下:

filename = strDirectoryName & "\1-TestFeedFile-" & strToday & "-" & iFile.ToString() & "of" & totalFile.ToString() & ".xls"

outputWriter = File.CreateText(filename)

xls文件的头部创建如下:

 line = "Blah1" & Chr(9) & "Blah2" & Chr(9) & "Blah3" & Chr(9)

outputWriter.WriteLine(line)

此代码最初是为了创建一个 .txt 文件而编写的,但后来改为创建一个 .xls,在这种情况下,我想知道是否必须更改代码以创建一个新的 excel 对象,然后可以使用并访问其工作表属性?

我不介意解决方案是用 VB.net 还是 C#

【问题讨论】:

标签: c# vb.net


【解决方案1】:

如果您想更改工作表名称,我建议使用Interop Assemblies

另外,check out this similar question

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-10-05
    • 1970-01-01
    相关资源
    最近更新 更多