public GetBuiltInName ( String builtInCode, int sheetNumber ) : NPOI.XSSF.UserModel.XSSFName | ||
builtInCode | String | |
sheetNumber | int | |
Результат | NPOI.XSSF.UserModel.XSSFName |
public void TestSetAutoFilter() { XSSFWorkbook wb = new XSSFWorkbook(); XSSFSheet sheet = (XSSFSheet)wb.CreateSheet("new sheet"); sheet.SetAutoFilter(CellRangeAddress.ValueOf("A1:D100")); Assert.AreEqual("A1:D100", sheet.GetCTWorksheet().autoFilter.@ref); // auto-filter must be registered in workboook.xml, see Bugzilla 50315 XSSFName nm = wb.GetBuiltInName(XSSFName.BUILTIN_FILTER_DB, 0); Assert.IsNotNull(nm); Assert.AreEqual(0u, nm.GetCTName().localSheetId); Assert.AreEqual(true, nm.GetCTName().hidden); Assert.AreEqual("_xlnm._FilterDatabase", nm.GetCTName().name); Assert.AreEqual("'new sheet'!$A$1:$D$100", nm.GetCTName().Value); }
public void bug55723b() { XSSFWorkbook wb = new XSSFWorkbook(); ISheet sheet = wb.CreateSheet(); // stored with a special name Assert.IsNull(wb.GetBuiltInName(XSSFName.BUILTIN_FILTER_DB, 0)); CellRangeAddress range = CellRangeAddress.ValueOf("A:B"); IAutoFilter filter = sheet.SetAutoFilter(range); Assert.IsNotNull(filter); // stored with a special name XSSFName name = wb.GetBuiltInName(XSSFName.BUILTIN_FILTER_DB, 0); Assert.IsNotNull(name); Assert.AreEqual("Sheet0!$A:$B", name.RefersToFormula); range = CellRangeAddress.ValueOf("B:C"); filter = sheet.SetAutoFilter(range); Assert.IsNotNull(filter); // stored with a special name name = wb.GetBuiltInName(XSSFName.BUILTIN_FILTER_DB, 0); Assert.IsNotNull(name); Assert.AreEqual("Sheet0!$B:$C", name.RefersToFormula); }