sitimoen / xdocreport

Automatically exported from code.google.com/p/xdocreport
0 stars 0 forks source link

More manageable option for conversion from DOCX to PDF using XWPF? #286

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Hello,

I wanted to know if there is any solution that let me add more settings and 
options in conversion, right now i know only how to set the font coding but its 
not enough.The result of the conversion is not really good, I want for example 
set the max marge for the headers ..

----------------------
Options options = options.getTo(ConverterTypeTo.PDF).via(ConverterTypeVia.XWPF);
options.subOptions(PdfOptions.create().fontEncoding("windows-1250"));
-------------------

Regards,
Bilel

Original issue reported on code.google.com by oueslatibilel216@gmail.com on 30 Jul 2013 at 5:50

GoogleCodeExporter commented 8 years ago
Hi Bilel,

As you hav seen, there are few options like font encoding.

For your problem with max marge, the converter should use the marge of docx. If 
you have a problem, please attach your docx which causes problem.

Regards Angelo

Original comment by angelo.z...@gmail.com on 30 Jul 2013 at 7:10

GoogleCodeExporter commented 8 years ago
Thank you Angelo for your answer, I think I have found the solution, I will use 
the iText XWPFDocument after reporting like following:

ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
report.process(context, outputStream);
byte[] mergedOutput = outputStream.toByteArray();
XWPFDocument document = new XWPFDocument(new 
ByteArrayInputStream(mergedOutput));
// do stuff with document ...
PdfOptions options = PdfOptions.create().fontEncoding("windows-1250");
OutputStream out = new FileOutputStream(new File(outputTemplate));
PdfConverter.getInstance().convert(document, out, options);

Original comment by oueslatibilel216@gmail.com on 30 Jul 2013 at 7:19

GoogleCodeExporter commented 8 years ago
I think it's really shame to use byte array just to change marge.

Could you tell me please what is your problem with marge? The converter doesn't 
use the marge defined in the docx? 

If you want you can attach your docx and enumerate the problems.

Original comment by angelo.z...@gmail.com on 30 Jul 2013 at 7:27

GoogleCodeExporter commented 8 years ago
I cant really share the document due to confidentiality but I can tell you that 
its not the marge the issue, the footer is smaller then the original in the 
docx file, the logo down is split in two.

Original comment by oueslatibilel216@gmail.com on 30 Jul 2013 at 7:43

GoogleCodeExporter commented 8 years ago
I'm sorry, but without attached docx, I cannot help you more.

Original comment by angelo.z...@gmail.com on 30 Jul 2013 at 7:46

GoogleCodeExporter commented 8 years ago
Thank you in any case, I will try to find out.

Original comment by oueslatibilel216@gmail.com on 30 Jul 2013 at 7:57

GoogleCodeExporter commented 8 years ago
As I have none docx attached, I close this issue.

Original comment by angelo.z...@gmail.com on 18 Feb 2014 at 2:48