示例#1
0
文件: XWPFRun.cs 项目: Yvees/npoi
        /**
         * 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);
        }
示例#2
0
        public void Bug57312_NullPointException()
        {
            XWPFDocument doc = XWPFTestDataSamples.OpenSampleDocument("57312.docx");

            Assert.IsNotNull(doc);

            foreach (IBodyElement bodyElement in doc.BodyElements)
            {
                BodyElementType elementType = bodyElement.ElementType;

                if (elementType == BodyElementType.PARAGRAPH)
                {
                    XWPFParagraph paragraph = (XWPFParagraph)bodyElement;

                    foreach (IRunElement iRunElem in paragraph.IRuns)
                    {
                        if (iRunElem is XWPFRun)
                        {
                            XWPFRun RunElement = (XWPFRun)iRunElem;

                            UnderlinePatterns underline = RunElement.Underline;
                            Assert.IsNotNull(underline);

                            //System.out.Println("Found: " + underline + ": " + RunElement.GetText(0));
                        }
                    }
                }
            }
        }
示例#3
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);
 }
示例#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);
        }