本文整理汇总了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);
}