Exemplo n.º 1
0
        /**
         * Specifies that the contents of this run.should be displayed along with an
         * underline appearing directly below the character heigh
         * If this element is not present, the default value is to leave the
         * formatting applied at previous level in the style hierarchy. If this
         * element is never applied in the style hierarchy, then an underline shall
         * not be applied to the contents of this run.
         *
         * @param value -
         *              underline type
         * @see UnderlinePatterns : all possible patterns that could be applied
         */
        public void SetUnderline(UnderlinePatterns value)
        {
            CT_RPr       pr        = run.IsSetRPr() ? run.rPr : run.AddNewRPr();
            CT_Underline underline = (pr.u == null) ? pr.AddNewU() : pr.u;

            underline.val = EnumConverter.ValueOf <ST_Underline, UnderlinePatterns>(value);
        }
Exemplo n.º 2
0
        /**
         * Get the CTUnderline for the run.
         * @param create Create a new underline if necessary
         * @return The underline, or null create is false and there is no underline.
         */
        private CT_Underline GetCTUnderline(bool create)
        {
            CT_RPr       pr        = GetRunProperties(true);
            CT_Underline underline = pr.u;

            if (create && underline == null)
            {
                underline = pr.AddNewU();
            }
            return(underline);
        }
Exemplo n.º 3
0
        public void TestSetGetUnderline()
        {
            CT_RPr rpr = ctRun.AddNewRPr();

            rpr.AddNewU().val = (ST_Underline.dash);

            XWPFRun run = new XWPFRun(ctRun, p);

            Assert.AreEqual(UnderlinePatterns.Dash, run.GetUnderline());

            run.SetUnderline(UnderlinePatterns.None);
            Assert.AreEqual(ST_Underline.none, rpr.u.val);
        }
Exemplo n.º 4
0
        public void SetUnderline(UnderlinePatterns value)
        {
            CT_RPr ctRpr = this.run.IsSetRPr() ? this.run.rPr : this.run.AddNewRPr();

            (ctRpr.u == null ? ctRpr.AddNewU() : ctRpr.u).val = EnumConverter.ValueOf <ST_Underline, UnderlinePatterns>(value);
        }