本文整理匯總了C#中NPOI.XSSF.UserModel.XSSFWorkbook.GetNameAt方法的典型用法代碼示例。如果您正苦於以下問題:C# XSSFWorkbook.GetNameAt方法的具體用法?C# XSSFWorkbook.GetNameAt怎麽用?C# XSSFWorkbook.GetNameAt使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類NPOI.XSSF.UserModel.XSSFWorkbook
的用法示例。
在下文中一共展示了XSSFWorkbook.GetNameAt方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: TestRepeatingRowsAndColums
public void TestRepeatingRowsAndColums()
{
// First Test that Setting RR&C for same sheet more than once only Creates a
// single Print_Titles built-in record
XSSFWorkbook wb = new XSSFWorkbook();
wb.CreateSheet("First Sheet");
wb.SetRepeatingRowsAndColumns(0, -1, -1, -1, -1);
// Set repeating rows and columns twice for the first sheet
for (int i = 0; i < 2; i++)
{
wb.SetRepeatingRowsAndColumns(0, 0, 0, 0, 3);
//sheet.CreateFreezePane(0, 3);
}
Assert.AreEqual(1, wb.NumberOfNames);
IName nr1 = wb.GetNameAt(0);
Assert.AreEqual(XSSFName.BUILTIN_PRINT_TITLE, nr1.NameName);
Assert.AreEqual("'First Sheet'!$A:$A,'First Sheet'!$1:$4", nr1.RefersToFormula);
//remove the columns part
wb.SetRepeatingRowsAndColumns(0, -1, -1, 0, 3);
Assert.AreEqual("'First Sheet'!$1:$4", nr1.RefersToFormula);
//revert
wb.SetRepeatingRowsAndColumns(0, 0, 0, 0, 3);
//remove the rows part
wb.SetRepeatingRowsAndColumns(0, 0, 0, -1, -1);
Assert.AreEqual("'First Sheet'!$A:$A", nr1.RefersToFormula);
//revert
wb.SetRepeatingRowsAndColumns(0, 0, 0, 0, 3);
// Save and re-open
IWorkbook nwb = XSSFTestDataSamples.WriteOutAndReadBack(wb);
Assert.AreEqual(1, nwb.NumberOfNames);
nr1 = nwb.GetNameAt(0);
Assert.AreEqual(XSSFName.BUILTIN_PRINT_TITLE, nr1.NameName);
Assert.AreEqual("'First Sheet'!$A:$A,'First Sheet'!$1:$4", nr1.RefersToFormula);
// check that Setting RR&C on a second sheet causes a new Print_Titles built-in
// name to be Created
nwb.CreateSheet("SecondSheet");
nwb.SetRepeatingRowsAndColumns(1, 1, 2, 0, 0);
Assert.AreEqual(2, nwb.NumberOfNames);
IName nr2 = nwb.GetNameAt(1);
Assert.AreEqual(XSSFName.BUILTIN_PRINT_TITLE, nr2.NameName);
Assert.AreEqual("SecondSheet!$B:$C,SecondSheet!$1:$1", nr2.RefersToFormula);
nwb.SetRepeatingRowsAndColumns(1, -1, -1, -1, -1);
}