|
1 | 1 | package com.fuse.reporting; |
2 | 2 |
|
| 3 | +import java.io.File; |
3 | 4 | import java.io.StringWriter; |
4 | 5 | import java.math.BigInteger; |
5 | 6 | import java.text.SimpleDateFormat; |
|
19 | 20 | import javax.persistence.EntityManager; |
20 | 21 | import javax.persistence.EntityManagerFactory; |
21 | 22 |
|
| 23 | +import org.docx4j.Docx4J; |
22 | 24 | import org.docx4j.TextUtils; |
23 | 25 | import org.docx4j.TraversalUtil; |
24 | 26 | import org.docx4j.XmlUtils; |
25 | 27 | import org.docx4j.convert.in.xhtml.XHTMLImporterImpl; |
| 28 | +import org.docx4j.convert.out.HTMLSettings; |
| 29 | +import org.docx4j.dml.CTShapeProperties; |
| 30 | +import org.docx4j.dml.Graphic; |
| 31 | +import org.docx4j.dml.GraphicData; |
| 32 | +import org.docx4j.dml.picture.Pic; |
| 33 | +import org.docx4j.dml.wordprocessingDrawing.Inline; |
26 | 34 | import org.docx4j.jaxb.Context; |
27 | 35 | import org.docx4j.jaxb.XPathBinderAssociationIsPartialException; |
28 | 36 | import org.docx4j.model.datastorage.migration.VariablePrepare; |
|
40 | 48 | import org.docx4j.wml.Br; |
41 | 49 | import org.docx4j.wml.CTShd; |
42 | 50 | import org.docx4j.wml.ContentAccessor; |
| 51 | +import org.docx4j.wml.Drawing; |
43 | 52 | import org.docx4j.wml.Ftr; |
44 | 53 | import org.docx4j.wml.Hdr; |
45 | 54 | import org.docx4j.wml.ObjectFactory; |
|
55 | 64 | import org.docx4j.wml.Text; |
56 | 65 | import org.docx4j.wml.Tr; |
57 | 66 | import org.docx4j.wml.CTTxbxContent; |
| 67 | +import org.w3c.dom.*; |
| 68 | +import javax.xml.bind.JAXBElement; |
58 | 69 |
|
59 | 70 | import com.faction.reporting.ReportFeatures; |
60 | 71 | import com.fuse.dao.Assessment; |
@@ -546,13 +557,14 @@ public WordprocessingMLPackage generateDocx(String customCSS) |
546 | 557 | return mlp; |
547 | 558 |
|
548 | 559 | } |
549 | | - |
550 | 560 |
|
551 | 561 | private List<Object> wrapHTML(String content, String customCSS, |
552 | 562 | String className) throws Docx4JException { |
553 | 563 | XHTMLImporterImpl xhtml = new XHTMLImporterImpl(mlp); |
554 | 564 | RFonts rfonts = Context.getWmlObjectFactory().createRFonts(); |
555 | 565 | rfonts.setAscii(this.FONT); |
| 566 | + XHTMLImporterImpl.addFontMapping("Arial", rfonts); |
| 567 | + XHTMLImporterImpl.addFontMapping("arial", rfonts); |
556 | 568 | if(className == null) { |
557 | 569 | className = ""; |
558 | 570 | } |
@@ -977,6 +989,8 @@ private String replacement(String content) { |
977 | 989 |
|
978 | 990 |
|
979 | 991 | //Fix images |
| 992 | + content = content.replaceAll("<img", "<center><img"); |
| 993 | + content = content.replaceAll("alt=\"image.png\" contenteditable=\"false\"><br></p>", "></center></p>"); |
980 | 994 | content = this.replaceImageLinks(content); |
981 | 995 |
|
982 | 996 | //Run extensions |
@@ -1365,7 +1379,6 @@ private int changeColorOfText(Tr row, String variable, String color) { |
1365 | 1379 | } |
1366 | 1380 | return -1; |
1367 | 1381 | } |
1368 | | - |
1369 | 1382 | /* |
1370 | 1383 | * Utility function to find elements in the docx file |
1371 | 1384 | */ |
|
0 commit comments