Hallo all,

I wrote similiar email to [EMAIL PROTECTED] mailing list more than week ago,
but didn't receive answer. I try to send it here, because it's Writer
API specific question.

I have Java extension, which should be able to import text tables.
Almost everything works for me. I'm trying to import complex text
table (merged, splitted cells) to my internal structure, which can
handle merged, splitted cells, etc.. My question is if my approach is
good enough or if there is easier way how to import text table
structure.

Horizontal cell merging
---------------------------------

Complex table doesn't have table column separators property set, but
each table row has table column separators property set. So, to
calculate relative width of all columns, merged cells, ... I use
following algorithm ...

 - initialize mTCS array
 - go through all rows table column separators properties
 - add all separators to mTCS array (if they're not included in mTCS array)
 - sort mTCS array

Now, mTCS array contains all table column separator positions from all
rows just once and is sorted. Number of all columns is mTCS.size() +
1. To calculate relative column width and merged cells, I use
following algorithm ...

 - get row table column separators property
 - go through all separators from a row and compare them to calculated
mTCS array
 - I can calculate column width and row span from this comparison

Example ...

 - mTCS array contains these numbers - 100, 200, 300, 400, 500
 - row's table column separators contains these positions - 200, 300

... so, from these numbers, I'm able to say, that the first cell in a
row is over two cells (separators 100, 200, row span = 2), second cell
in a row is over one cell (separator 300, row span = 1) and the last
cell in a row is over all remaining cells (separators 400, 500, table
end, rowspan = 3).

Vertical cell merging
-----------------------------

I assume that if there are cells A1, A2, A3 and A5 (A4 is missing)
that the cell A3 is merged (A3:A4 in a simple table).

Conclusion
----------------

There's an easy way how to obtain cell content, formatting, etc. if I
know cell name and I'm not interested in table structure. But, there's
no easy way how to reconstruct table structure. Or am I missed
something? Some property, method, ...? Is this good approach or should
I use another one?

Regards,
Robert

-- 
Robert Vojta

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to