Esempio n. 1
0
        /// <summary>
        /// Add a new AbstractNum
        /// </summary>
        /// <returns></returns>
        /// @author antony liu
        public string AddAbstractNum()
        {
            CT_AbstractNum  ctAbstractNum = ctNumbering.AddNewAbstractNum();
            XWPFAbstractNum abstractNum   = new XWPFAbstractNum(ctAbstractNum, this);

            abstractNum.AbstractNumId  = abstractNums.Count.ToString();
            abstractNum.MultiLevelType = MultiLevelType.HybridMultilevel;
            abstractNum.InitLvl();
            abstractNums.Add(abstractNum);
            return(abstractNum.GetAbstractNum().abstractNumId);
        }
Esempio n. 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);
        }
Esempio n. 3
0
        /**
         * add a new AbstractNum and return its AbstractNumID
         * @param abstractNum
         */
        public string AddAbstractNum(XWPFAbstractNum abstractNum)
        {
            int pos = abstractNums.Count;

            if (abstractNum.GetAbstractNum() != null)
            { // Use the current CTAbstractNum if it exists
                ctNumbering.AddNewAbstractNum().Set(abstractNum.GetAbstractNum());
            }
            else
            {
                ctNumbering.AddNewAbstractNum();
                abstractNum.GetAbstractNum().abstractNumId = pos.ToString();
                ctNumbering.SetAbstractNumArray(pos, abstractNum.GetAbstractNum());
            }
            abstractNums.Add(abstractNum);
            return(abstractNum.GetAbstractNum().abstractNumId);
        }
Esempio n. 4
0
        /**
         * Compare AbstractNum with abstractNums of this numbering document.
         * If the content of abstractNum Equals with an abstractNum of the List in numbering
         * the Bigint Value of it will be returned.
         * If no equal abstractNum is existing null will be returned
         *
         * @param abstractNum
         * @return  Bigint
         */
        public string GetIdOfAbstractNum(XWPFAbstractNum abstractNum)
        {
            CT_AbstractNum  copy           = (CT_AbstractNum)abstractNum.GetCTAbstractNum().Copy();
            XWPFAbstractNum newAbstractNum = new XWPFAbstractNum(copy, this);
            int             i;

            for (i = 0; i < abstractNums.Count; i++)
            {
                newAbstractNum.GetCTAbstractNum().abstractNumId = i.ToString();
                newAbstractNum.SetNumbering(this);
                if (newAbstractNum.GetCTAbstractNum().ValueEquals(abstractNums[i].GetCTAbstractNum()))
                {
                    return(newAbstractNum.GetCTAbstractNum().abstractNumId);
                }
            }
            return(null);
        }