Page 1 of 1

text width / ending position

PostPosted: Thu Jun 20, 2013 8:17 pm
by Joerakel
Hi,

I have implementet the correct setting of tab stops by using "position:absolute" and values from the <w:tabs> tag and it works fine for converting from docx to xhtml BUT after that I convert my xhtml to .epub using calibre and it seems that calibre doesent convert <span> elements with style="position:absolute.... BUT it converts correct when I use position:relative so what I am trying to do now is rewriting my tab stops implementation in a way that the position is relative to the previous element like:

<p>
<span style="position:relative; left:0pt">text1</span>
<span style="position:relative; left:234pt">text2</span>
...
</p>

before I used position:absolute which was no problem but now that I use "relative" I need to know the END position of the previous element.

relative position of the current element = absolut position from <tabs> tag for current element - end_position from previous element

so finally my question is, can I get the ending position of the previous element OR can I somehow geht the width of the previous element

regards
Joe

Re: text width / ending position

PostPosted: Thu Jun 20, 2013 10:40 pm
by jason
Sorry, docx4j doesn't do any layout calculations of its own. You might be able to implement something sufficient for your use case (calculations based on number of characters x font size etc)

Re: text width / ending position

PostPosted: Fri Jun 28, 2013 11:30 pm
by Joerakel
Oooook, shame on me, I had two epub readers in use and both did not show me the spans with "position:absolute" in it till I switched one of my readers to show only one page at a time and now it works. So I'm writing this here to correct my statement that calibre doesn't do this, it is able to do this (maybe off topic because this is the docx4j forum but I had to correct it).

regards
Joe

Re: text width / ending position

PostPosted: Sun Aug 17, 2014 9:20 am
by xanguera
Hi,
I realize this page is more than one year old, but it turns out I have been looking for a few days now for a way to get an html file from a docx with absolute positioning of words. As you seem to have managed to do this, would you mind posting the exact command line you used, or how you got it to work?

Thank you

Re: text width / ending position

PostPosted: Sun Aug 17, 2014 10:58 am
by jason
No, Joe's problem/solution was limited to tab stops. Sorry.