Re: Figure out which cells are merged in a streaming fashion

Tomasz Melcer <[email protected]>
Newsgroups gmane.comp.jakarta.poi.user
Message-ID <pony-0bf13813f7eebf637352e1cdca37d1df685af31b-f9a935d3f792debcdebe0ce6528ca9718decf8c6@user.poi.apache.org>
On 2020/03/20 18:26:04, Tomasz Melcer <[email protected]> wrote: 
> However, I cannot find information on how to recognize merged cells in a streaming fashion. Is it even possible? As far as I know, in case of xlsx files, information on which cells are in a merged region is stored in the <mergeCells> element of the sheet xml, and in my example files this element is at the end of the file.

I ended up writing my own parser that using XSSFReader seeks the following template:

<mergeCells count="2">
  <mergeCell ref="A1:B2" />
  <mergeCell ref="C3:D4" />
</mergeCells>

I do two runs over each sheet: first to detect merged cells, second to actually parse content. So far it works, and the first run is surprisingly fast.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.