opensagres / xdocreport

XDocReport means XML Document reporting. It's Java API to merge XML document created with MS Office (docx) or OpenOffice (odt), LibreOffice (odt) with a Java model to generate report and convert it if you need to another format (PDF, XHTML...).
https://github.com/opensagres/xdocreport
1.23k stars 373 forks source link

DOCX to PDF superscript and subscript #69

Open SaruMAN21rus opened 9 years ago

SaruMAN21rus commented 9 years ago

DOCX to PDF converter doesn't manage superscript and subscript.

angelozerr commented 9 years ago

@blagae have you time to see this issue?

blagae commented 9 years ago

Yes I'll look into it.

Do you know if XDocReport already supports this, e.g. for ODF ? If I need to write attribute detection code, that'll take some more time than just the handling of the attribute.

angelozerr commented 9 years ago

Yes I'll look into it.

Thanks!

Do you know if XDocReport already supports this, e.g. for ODF ?

I don't remember that -(

blagae commented 9 years ago

I have made a basic attempt to support this. I have tested this only in the iText 5 plugin, but the code exists also for iText 2 and should work the same. Font size is reset to 65% of original size, text rise is +33% higher for superscript, and 10% lower for subscript. This is roughly what MS Word does.

@SaruMAN21rus: Please test this by building locally, because I prefer not to propagate this to master before being sure that it works to your satisfaction. See feature branch feature/subsuper on my fork https://github.com/blagae/xdocreport/tree/feature/subsuper

@angelozerr: I had to change the signature of XWPFDocumentVisitor::visitStyleText, which is overridden in the XHTMLMapper. I hope that's ok with you.

angelozerr commented 9 years ago

@angelozerr: I had to change the signature of XWPFDocumentVisitor::visitStyleText, which is overridden in the XHTMLMapper. I hope that's ok with you.

No pb with that, refactoring must be done every time to improve software:) Thanks for your info and future contribution.

SaruMAN21rus commented 9 years ago

@blagae Hello. This work fine. But if add a table, the superscript without text moves up to the previous line. Template: image Convert by IText 2: image Convert by Itext 5: image