docx4j

Docx4J Generated XLSX file is always corrupt

三世轮回 提交于 2021-02-11 15:19:14
问题 TL;DR: Excel Workbook generated by Docx4J always says corrupted but I can't determine what Excel doesn't like about the underlying XML, let alone how to fix it. My use case is as follows: I am trying to produce an excel workbook with charts and graphs automatically on a regular basis. Only the raw data will change but everything else will dynamically update as the raw data is changed. So I built an excel workbook which has a number of charts and graphs being generated by a sheet of raw data.

How to correct display last line of justified paragraph Docx4j

萝らか妹 提交于 2021-02-11 12:36:05
问题 I have a paragraph Justified with a PPr object. All paragraph is justified but the last line not. I know that it's necessary use a LineBreak after last line to give the correct justification. I try with PPr with set a JC object but doesn't work PPr bothPPr = factory.createPPr(); Jc justified = factory.createJc(); bothPPr.setJc(justified); P p = factory.createP(); R r = factory.createR(); Text t = factory.createText(); t.setValue("Long text here..."); r.getContent().add(t); r.getContent().add

converting docx to pdf

拟墨画扇 提交于 2021-01-29 10:16:37
问题 I am converting docx to pdf which works fine. But the problem is it misses the formatting the document. How to ensure the formatting such as [bold, tablets etc]] are not lost while converting. I am using docx4j for conversion . Below is the exception I am getting NOT IMPLEMENTED: support for w:ptab - NOT IMPLEMENTED: support for w:ptab -3 NOT IMPLEMENTED: support for w:altChunk - NOT IMPLEMENTED: support for w:altChunk - NOT IMPLEMENTED: support for w:altChunk - NOT IMPLEMENTED: support for w

Excel size decreases on resaving using docx4j library implementation

孤者浪人 提交于 2021-01-29 09:10:47
问题 When i generate excel using below code the file size is 79kb. (STEP 1) If i open the excel, do nothing and save it. The file size decreases to 33kb. (STEP 2) What could be reason for it and how can i avoid this? After extracting the excels i obeserved that theres size variation for drawing.xml's. Step 2 Xml is formatted and has leading and trailing spaces. Where as Step 1 xmls are TRIMMED . I have used DOC4j library for the implementation. After resaving the file size decreases. ` public

embed images as base64 instead of outputing to folder

旧城冷巷雨未停 提交于 2021-01-28 19:32:34
问题 When converting from docx to html you may specify the output path for any images org.docx4j.Docx4J.toHTML(wordMLPackage, imageDirPath, imageTargetUri, fos2); and the resulting html document references images via files: <img height="22" id="rId7" src="..cc6bcedf-2770-45ad-8e81-610bbd8746ceimage1.png" width="42"> Instead I would like the converter to embed the files as base64. Is this possible? 回答1: You can write your own ConversionImageHandler implementation to do that. The default

Change font style of whole sentence in docx

余生颓废 提交于 2021-01-05 07:09:13
问题 I have been trying to change the font style of specific sentences in the docx file using Apache POI, (XWPF). I am able to change the font style (ex.color,font family) of whole document using XWPFRun -> run.setColor(color) but the problem is for some reaseon, it generates multiple run for a single sentence. Example: Sentence: This is the sentence that has multiple run. Run >: This is the Run >: sentence Run >:that has mul Run >:tiple run Run >: . So, if i try to find the sentence from the file

Change font style of whole sentence in docx

随声附和 提交于 2021-01-05 07:08:21
问题 I have been trying to change the font style of specific sentences in the docx file using Apache POI, (XWPF). I am able to change the font style (ex.color,font family) of whole document using XWPFRun -> run.setColor(color) but the problem is for some reaseon, it generates multiple run for a single sentence. Example: Sentence: This is the sentence that has multiple run. Run >: This is the Run >: sentence Run >:that has mul Run >:tiple run Run >: . So, if i try to find the sentence from the file

Docx to HTML: Headings' font style is not correct using DOCX4J

笑着哭i 提交于 2020-12-14 23:55:13
问题 I have a docx file with Heading1 style with Calibri Light (every other texts use Calibri Light too). After converting to html, Every texts are Calibri Light (correctly), but the text with Heading1 style is Times New Roman when I open the html file. (The reason: there is no font-family set for Heading1 style, inside of html file) When I open the docx file and check the Heading1 style's font, it says Calibri Light. Heading1 is based on "Normal" style in docx. This is the Normal style in docx: