C# 使用C创建新的Excel工作表名称#
我这里有我混淆的代码 我想要的是创建一个程序,当我有两个都有15个孩子的父键时。。它将自动在我的excel工作表上显示其属性,但随后可以成功创建第一个键。。显然,第二个键有一个错误,因为它试图保存在与键1相同的工作表上。你们中有人知道如何使用GetSheetNo吗?还是复印件C# 使用C创建新的Excel工作表名称#,c#,excel,split,C#,Excel,Split,我这里有我混淆的代码 我想要的是创建一个程序,当我有两个都有15个孩子的父键时。。它将自动在我的excel工作表上显示其属性,但随后可以成功创建第一个键。。显然,第二个键有一个错误,因为它试图保存在与键1相同的工作表上。你们中有人知道如何使用GetSheetNo吗?还是复印件 int cntAddMember = 0; int cntPage = 0; string sheetName = dbReportDef.WorkS
int cntAddMember = 0;
int cntPage = 0;
string sheetName = dbReportDef.WorkSheet;
string copyBaseSheet = "TEMP" + sheetName;
string boforeSheet = sheetName;
int boforeSheetPos = this.excel.GetSheetNo(boforeSheet);
used to check the value of the sheetfirst before creating a new one,
if (dbReportDef.IsAddMember)
{
if (this.detailNum < 0) { this.detailNum = GetDetailLine(sheetName, dbReportDef.CellNo); }
if (!this.excel.ExistSheet(copyBaseSheet))
{ this.excel.CopySheet(sheetName, copyBaseSheet, boforeSheetPos); }
}
int cntAddMember=0;
int cntPage=0;
string sheetName=dbReportDef.WorkSheet;
字符串copybasheet=“TEMP”+sheetName;
字符串BO前页=图纸名称;
int boforeSheetPos=this.excel.GetSheetNo(boforeSheet);
用于在创建新图纸之前先检查图纸的值,
if(dbReportDef.IsAddMember)
{
如果(this.detailNum<0){this.detailNum=GetDetailLine(sheetName,dbReportDef.CellNo);}
如果(!this.excel.ExistSheet(copybasheet))
{this.excel.CopySheet(sheetName、copyBaseSheet、boforeSheetPos);}
}
谢谢:)你在这里用什么?Excel Interop?@shree.pat18是的,我将发布另一个代码,每次您尝试创建sheetname时,它都会检查其原始值Interop在MSDN站点上有相当全面的文档。您应该先查看一下,了解这些方法的作用,然后根据需要修改后再尝试。@shree.pat18尝试过,但似乎没有按照我希望的方式工作。我在想,也许在第一个代码之后,我会创建一个条件,其中键将在一个数组中,表的值将是sheet=sheet+数组的索引值,首先是1,在它发布所有子元素之后,索引值将是2,这取决于有多少个键