D
D
DarkByte20152017-08-02 12:13:20
Java
DarkByte2015, 2017-08-02 12:13:20

How to find out the "length" of a cell in Apache Poi?

Reading xlsx using apache poi. What if the exact format is not known in advance, but I know that there are merged cells in the file? How can I see the length of a cell? Those. How many columns does it span? For example, there is a cell merged "B2:C2", I got its Cell object, but I do not find a single method in it that allows you to find out how many columns it is stretched (if, of course, it is stretched at all). How to find out?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
L
Labunsky, 2017-08-02
@DarkByte2015

Merged cells - a group of ordinary cells, the value is stored in the upper right corner. Thus, when you receive a Cell object, you do not get a merged cell, but a piece of it (with or without a value).
To determine if a cell belongs to a merged group, you can use the code from here . You can calculate the length using it with a rather trivial method

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question