Package org.apache.poi.xwpf.usermodel

Examples of org.apache.poi.xwpf.usermodel.XWPFHyperlinkRun


          tfmtg.setItalic(run.isItalic());
       }

       boolean addedHREF = false;
       if(run instanceof XWPFHyperlinkRun) {
          XWPFHyperlinkRun linkRun = (XWPFHyperlinkRun)run;
          XWPFHyperlink link = linkRun.getHyperlink(document);
          if(link != null && link.getURL() != null) {
             xhtml.startElement("a", "href", link.getURL());
             addedHREF = true;
          } else if(linkRun.getAnchor() != null && linkRun.getAnchor().length() > 0) {
             xhtml.startElement("a", "href", "#" + linkRun.getAnchor());
             addedHREF = true;
          }
       }

       xhtml.characters(run.toString());
View Full Code Here


      assertFalse(ps.getRuns().get(0) instanceof XWPFHyperlinkRun);
      assertFalse(ph.getRuns().get(0) instanceof XWPFHyperlinkRun);
      assertTrue(ph.getRuns().get(1) instanceof XWPFHyperlinkRun);
      assertFalse(ph.getRuns().get(2) instanceof XWPFHyperlinkRun);

      XWPFHyperlinkRun link = (XWPFHyperlinkRun)ph.getRuns().get(1);
      assertEquals("http://poi.apache.org/", link.getHyperlink(hyperlink).getURL());


      // Test the old style decorator
      // You probably don't want to still be using it...
      assertEquals(
View Full Code Here

            curItalic = run.isItalic();
          }

          boolean addedHREF = false;
          if(run instanceof XWPFHyperlinkRun) {
             XWPFHyperlinkRun linkRun = (XWPFHyperlinkRun)run;
             XWPFHyperlink link = linkRun.getHyperlink(document);
             if(link != null && link.getURL() != null) {
                xhtml.startElement("a", "href", link.getURL());
                addedHREF = true;
             } else if(linkRun.getAnchor() != null && linkRun.getAnchor().length() > 0) {
                xhtml.startElement("a", "href", "#" + linkRun.getAnchor());
                addedHREF = true;
             }
          }

          xhtml.characters(run.toString());
View Full Code Here

      
       // Do the text
       for(XWPFRun run : paragraph.getRuns()) {
          List<String> tags = new ArrayList<String>();
          if(run instanceof XWPFHyperlinkRun) {
             XWPFHyperlinkRun linkRun = (XWPFHyperlinkRun)run;
             XWPFHyperlink link = linkRun.getHyperlink(document);
             if(link != null && link.getURL() != null) {
                xhtml.startElement("a", "href", link.getURL());
                tags.add("a");
             }
          }
View Full Code Here

      assertFalse(ps.getRuns().get(0) instanceof XWPFHyperlinkRun);
      assertFalse(ph.getRuns().get(0) instanceof XWPFHyperlinkRun);
      assertTrue(ph.getRuns().get(1) instanceof XWPFHyperlinkRun);
      assertFalse(ph.getRuns().get(2) instanceof XWPFHyperlinkRun);

      XWPFHyperlinkRun link = (XWPFHyperlinkRun)ph.getRuns().get(1);
      assertEquals("http://poi.apache.org/", link.getHyperlink(hyperlink).getURL());


      // Test the old style decorator
      // You probably don't want to still be using it...
      assertEquals(
View Full Code Here

      assertFalse(ps.getRuns().get(0) instanceof XWPFHyperlinkRun);
      assertFalse(ph.getRuns().get(0) instanceof XWPFHyperlinkRun);
      assertTrue(ph.getRuns().get(1) instanceof XWPFHyperlinkRun);
      assertFalse(ph.getRuns().get(2) instanceof XWPFHyperlinkRun);

      XWPFHyperlinkRun link = (XWPFHyperlinkRun)ph.getRuns().get(1);
      assertEquals("http://poi.apache.org/", link.getHyperlink(hyperlink).getURL());


      // Test the old style decorator
      // You probably don't want to still be using it...
      assertEquals(
View Full Code Here

            curItalic = run.isItalic();
          }

          boolean addedHREF = false;
          if(run instanceof XWPFHyperlinkRun) {
             XWPFHyperlinkRun linkRun = (XWPFHyperlinkRun)run;
             XWPFHyperlink link = linkRun.getHyperlink(document);
             if(link != null && link.getURL() != null) {
                xhtml.startElement("a", "href", link.getURL());
                addedHREF = true;
             } else if(linkRun.getAnchor() != null && linkRun.getAnchor().length() > 0) {
                xhtml.startElement("a", "href", "#" + linkRun.getAnchor());
                addedHREF = true;
             }
          }

          xhtml.characters(run.toString());
View Full Code Here

      
       // Do the text
       for(XWPFRun run : paragraph.getRuns()) {
          List<String> tags = new ArrayList<String>();
          if(run instanceof XWPFHyperlinkRun) {
             XWPFHyperlinkRun linkRun = (XWPFHyperlinkRun)run;
             XWPFHyperlink link = linkRun.getHyperlink(document);
             if(link != null && link.getURL() != null) {
                xhtml.startElement("a", "href", link.getURL());
                tags.add("a");
             } else if(linkRun.getAnchor() != null && linkRun.getAnchor().length() > 0) {
                xhtml.startElement("a", "href", "#" + linkRun.getAnchor());
                tags.add("a");
             }
          }
          if(run.isBold()) {
             xhtml.startElement("b");
View Full Code Here

          tfmtg.setItalic(run.isItalic());
       }

       boolean addedHREF = false;
       if(run instanceof XWPFHyperlinkRun) {
          XWPFHyperlinkRun linkRun = (XWPFHyperlinkRun)run;
          XWPFHyperlink link = linkRun.getHyperlink(document);
          if(link != null && link.getURL() != null) {
             xhtml.startElement("a", "href", link.getURL());
             addedHREF = true;
          } else if(linkRun.getAnchor() != null && linkRun.getAnchor().length() > 0) {
             xhtml.startElement("a", "href", "#" + linkRun.getAnchor());
             addedHREF = true;
          }
       }

       xhtml.characters(run.toString());
View Full Code Here

TOP

Related Classes of org.apache.poi.xwpf.usermodel.XWPFHyperlinkRun

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.