Ejemplo n.º 1
0
        /**
         * Add a new num with an abstractNumID and a numID
         * @param abstractNumID
         * @param numID
         */
        public void AddNum(string abstractNumID, string numID)
        {
            CT_Num ctNum = this.ctNumbering.AddNewNum();

            ctNum.AddNewAbstractNumId();
            ctNum.abstractNumId.val = (abstractNumID);
            ctNum.numId             = (numID);
            XWPFNum num = new XWPFNum(ctNum, this);

            nums.Add(num);
        }
Ejemplo n.º 2
0
        /**
         * Add a new num with an abstractNumID
         * @return return NumId of the Added num
         */
        public string AddNum(string abstractNumID)
        {
            CT_Num ctNum = this.ctNumbering.AddNewNum();

            ctNum.AddNewAbstractNumId();
            ctNum.abstractNumId.val = (abstractNumID);
            ctNum.numId             = (nums.Count + 1).ToString();
            XWPFNum num = new XWPFNum(ctNum, this);

            nums.Add(num);
            return(ctNum.numId);
        }
Ejemplo n.º 3
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);
        }
Ejemplo n.º 4
0
        /**
         * return the abstractNumID
         * If the AbstractNumID not exists
         * return null
         * @param       numID
         * @return      abstractNumID
         */
        public string GetAbstractNumID(string numID)
        {
            XWPFNum num = GetNum(numID);

            if (num == null)
            {
                return(null);
            }
            if (num.GetCTNum() == null)
            {
                return(null);
            }
            if (num.GetCTNum().abstractNumId == null)
            {
                return(null);
            }
            return(num.GetCTNum().abstractNumId.val);
        }
Ejemplo n.º 5
0
        public void TestAddNumberingToDoc()
        {
            string abstractNumId = "1";
            string numId         = "1";

            XWPFDocument  docOut    = new XWPFDocument();
            XWPFNumbering numbering = docOut.CreateNumbering();

            numId = numbering.AddNum(abstractNumId);

            XWPFDocument docIn = XWPFTestDataSamples.WriteOutAndReadBack(docOut);

            numbering = docIn.GetNumbering();
            Assert.IsTrue(numbering.NumExist(numId));
            XWPFNum num = numbering.GetNum(numId);

            string CompareAbstractNum = num.GetCTNum().abstractNumId.val;

            Assert.AreEqual(abstractNumId, CompareAbstractNum);
        }
Ejemplo n.º 6
0
 /**
  * Add a new num with an abstractNumID and a numID
  * @param abstractNumID
  * @param numID
  */
 public void AddNum(string abstractNumID, string numID)
 {
     CT_Num ctNum = this.ctNumbering.AddNewNum();
     ctNum.AddNewAbstractNumId();
     ctNum.abstractNumId.val = (abstractNumID);
     ctNum.numId = (numID);
     XWPFNum num = new XWPFNum(ctNum, this);
     nums.Add(num);
 }
Ejemplo n.º 7
0
 /**
  * Add a new num with an abstractNumID
  * @return return NumId of the Added num 
  */
 public string AddNum(string abstractNumID)
 {
     CT_Num ctNum = this.ctNumbering.AddNewNum();
     ctNum.AddNewAbstractNumId();
     ctNum.abstractNumId.val = (abstractNumID);
     ctNum.numId = (nums.Count + 1).ToString();
     XWPFNum num = new XWPFNum(ctNum, this);
     nums.Add(num);
     return ctNum.numId;
 }
Ejemplo n.º 8
0
 /**
  * add a new number to the numbering document
  * @param num
  */
 public string AddNum(XWPFNum num){
     ctNumbering.AddNewNum();
     int pos = (ctNumbering.GetNumList().Count) - 1;
     ctNumbering.SetNumArray(pos, num.GetCTNum());
     nums.Add(num);
     return num.GetCTNum().numId;
 }