Example #1
0
        /**
         * Returns numbering format for this paragraph, eg bullet or
         *  lowerLetter.
         * Returns null if this paragraph does not have numeric style.
         */
        public String GetNumFmt()
        {
            string        numID     = GetNumID();
            XWPFNumbering numbering = document.GetNumbering();

            if (numID != null && numbering != null)
            {
                XWPFNum num = numbering.GetNum(numID);
                if (num != null)
                {
                    string         ilvl          = GetNumIlvl();
                    string         abstractNumId = num.GetCTNum().abstractNumId.val;
                    CT_AbstractNum anum          = numbering.GetAbstractNum(abstractNumId).GetAbstractNum();
                    CT_Lvl         level         = null;
                    for (int i = 0; i < anum.lvl.Count; i++)
                    {
                        CT_Lvl lvl = anum.lvl[i];
                        if (lvl.ilvl.Equals(ilvl))
                        {
                            level = lvl;
                            break;
                        }
                    }
                    if (level != null)
                    {
                        return(level.numFmt.val.ToString());
                    }
                }
            }
            return(null);
        }
Example #2
0
        public void TestCompareAbstractNum()
        {
            XWPFDocument  doc       = XWPFTestDataSamples.OpenSampleDocument("Numbering.docx");
            XWPFNumbering numbering = doc.GetNumbering();
            int           numId     = 1;

            Assert.IsTrue(numbering.NumExist(numId.ToString()));
            XWPFNum         num                = numbering.GetNum(numId.ToString());
            string          abstrNumId         = num.GetCTNum().abstractNumId.val;
            XWPFAbstractNum abstractNum        = numbering.GetAbstractNum(abstrNumId);
            string          CompareAbstractNum = numbering.GetIdOfAbstractNum(abstractNum);

            Assert.AreEqual(abstrNumId, CompareAbstractNum);
        }