c#导出excel,如何设置工作表名
展开全部
这个比较容易实现,可以在Spire.XLS.dll的辅助下完成,参考这篇教程:C# 命名工作表
using Spire.Xls;
namespace changeename
{
class Program
{
static void Main(string[] args)
{
Workbook workbook = new Workbook();
workbook.LoadFromFile(@"D:\michelle\my file\Excel Font.xlsx");
Worksheet worksheet = workbook.Worksheets[0];
Worksheet worksheet1 = workbook.Worksheets[1];
Worksheet worksheet2 = workbook.Worksheets[2];
worksheet.Name = "Rename sheet1";
worksheet1.Name = "Rename sheet2";
worksheet2.Name = "Rename sheet3";
worksheet.TabColor = Color.DarkGreen;
worksheet1.TabColor = Color.Red;
worksheet2.TabColor = Color.Gold;
workbook.SaveToFile("Reanme.xlsx",ExcelVersion.Version2010);
System.Diagnostics.Process.Start(workbook.FileName);
}
}
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |