How to calculate the height of an element?

前端 未结 2 1499
独厮守ぢ
独厮守ぢ 2021-01-29 12:32

I am generating pdf files by XML data.

I calculate the height of a paragraph element as :

float paraWidth = 0.0f;
for (Object o : el.getChunks()) {
    p         


        
2条回答
  •  抹茶落季
    2021-01-29 13:18

    Firstly why you iterating over Chunk collection casted to Object ? If all elements of this collection are Chunk, use this:

    for (Chunk c : el.getChunks()) {
        paraWidth += c.getWidthPoint();
    }
    

    What do you mean saying method does not works correctly ?

提交回复
热议问题