Changeset 1724 for trunk/docx4j
- Timestamp:
- 11/30/11 13:13:03 (6 months ago)
- Location:
- trunk/docx4j/src/main/java/org/docx4j
- Files:
-
- 2 edited
-
convert/in/xhtml/Importer.java (modified) (7 diffs)
-
model/datastorage/BindingHandler.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/docx4j/src/main/java/org/docx4j/convert/in/xhtml/Importer.java
r1723 r1724 70 70 protected static Logger log = Logger.getLogger(Importer.class); 71 71 72 /** 73 * Configure, how the Importer styles hyperlinks 74 * 75 * If hyperlinkStyleId is set to <code>null</code>, hyperlinks are 76 * styled using just the CSS. This is the default behavior. 77 * 78 * If hyperlinkStyleId is set to <code>"someWordHyperlinkStyleName"</code>, 79 * strings containing 'http://' or 'https://' or or 'mailto:' are converted to w:hyperlink. 80 * The default Word hyperlink style name is "Hyperlink". 81 * 82 * Due to the architecture of this class, this is a static flag changing the 83 * behavior of all following calls. 84 * 85 * @param hyperlinkStyleID 86 * The style to use for hyperlinks (eg Hyperlink) 87 */ 88 public static void setHyperlinkStyle ( 89 String hyperlinkStyleID) { 90 hyperlinkStyleId = hyperlinkStyleID; 91 } 92 private static String hyperlinkStyleId = null; 72 93 private List<Object> imports = new ArrayList<Object>(); 73 94 // public List<Object> getImportedContent() { … … 91 112 92 113 listHelper = new ListHelper(); 114 115 if (hyperlinkStyleId !=null && wordMLPackage instanceof WordprocessingMLPackage) { 116 ((WordprocessingMLPackage)wordMLPackage).getMainDocumentPart().getPropertyResolver().activateStyle(hyperlinkStyleId); 117 } 118 93 119 } 94 120 … … 390 416 s.getElement().getAttribute("href"), 391 417 addRunProperties( cssMap ), 392 "Hyperlink",393 418 s.getElement().getAttribute("href"), rp); 394 419 currentP.getContent().add(h); … … 416 441 s.getElement().getAttribute("href"), 417 442 addRunProperties( cssMap ), 418 "Hyperlink",theText, rp);443 theText, rp); 419 444 currentP.getContent().add(h); 420 445 … … 499 524 } 500 525 501 private Hyperlink createHyperlink(String url, RPr rPr, String style, StringlinkText, RelationshipsPart rp) {526 private Hyperlink createHyperlink(String url, RPr rPr, String linkText, RelationshipsPart rp) { 502 527 503 528 try { … … 522 547 "xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\" >" + 523 548 "<w:r>" + 524 "<w:rPr>" +525 "<w:rStyle w:val=\"" + style + "\" />" +526 "</w:rPr>" +527 549 "<w:t>" + linkText + "</w:t>" + 528 550 "</w:r>" + … … 532 554 R r = (R)hyperlink.getContent().get(0); 533 555 r.setRPr(rPr); 534 RStyle rStyle = Context.getWmlObjectFactory().createRStyle(); 535 rStyle.setVal(style); 536 rPr.setRStyle(rStyle ); 537 556 if (hyperlinkStyleId!=null) { 557 RStyle rStyle = Context.getWmlObjectFactory().createRStyle(); 558 rStyle.setVal(hyperlinkStyleId); 559 rPr.setRStyle(rStyle ); 560 } 538 561 return hyperlink; 539 562 -
trunk/docx4j/src/main/java/org/docx4j/model/datastorage/BindingHandler.java
r1722 r1724 283 283 } 284 284 285 Importer.setHyperlinkStyle(hyperlinkStyleId); 285 286 String baseUrl = null; 286 287 List<Object> results = Importer.convertFromString(unescaped, pkg, baseUrl );
Note: See TracChangeset
for help on using the changeset viewer.
