Пример #1
0
        public void TestAddNameX()
        {
            HSSFWorkbook     hwb = new HSSFWorkbook();
            InternalWorkbook wb  = TestHSSFWorkbook.GetInternalWorkbook(hwb);

            Assert.IsNotNull(wb.GetNameXPtg("ISODD", UDFFinder.GetDefault()));

            FreeRefFunction1 NotImplemented = new FreeRefFunction1();

            /**
             * register the two test UDFs in a UDF Finder, to be passed to the Evaluator
             */
            UDFFinder udff1 = new DefaultUDFFinder(new String[] { "myFunc", },
                                                   new FreeRefFunction[] { NotImplemented });
            UDFFinder udff2 = new DefaultUDFFinder(new String[] { "myFunc2", },
                                                   new FreeRefFunction[] { NotImplemented });
            UDFFinder udff = new AggregatingUDFFinder(udff1, udff2);

            Assert.IsNotNull(wb.GetNameXPtg("myFunc", udff));
            Assert.IsNotNull(wb.GetNameXPtg("myFunc2", udff));

            Assert.IsNull(wb.GetNameXPtg("myFunc3", udff));  // myFunc3 is unknown

            hwb.Close();
        }