jferard / fastods

A very fast and lightweight (no dependency) library for creating ODS (Open Document Spreadsheet, mainly for Calc) files in Java. It's a Martin Schulz's SimpleODS fork
GNU General Public License v3.0
36 stars 6 forks source link

Fix: repeated null-field cells are ignored when they are at the end of a row #165

Closed ashitikov-bld closed 4 years ago

ashitikov-bld commented 4 years ago

tag is not inserted in the resulting xml when there's a bunch of null-field cells at the end of a row 06-09-2019 19-38-31 image

codecov-io commented 4 years ago

Codecov Report

Merging #165 into master will decrease coverage by 0.02%. The diff coverage is 0%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #165      +/-   ##
============================================
- Coverage     94.88%   94.85%   -0.03%     
  Complexity     2425     2425              
============================================
  Files           212      212              
  Lines          6430     6432       +2     
  Branches        480      481       +1     
============================================
  Hits           6101     6101              
- Misses          180      181       +1     
- Partials        149      150       +1
Impacted Files Coverage Δ Complexity Δ
.../java/com/github/jferard/fastods/TableRowImpl.java 93.93% <0%> (-1.94%) 40 <0> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 5e43f7c...2f0bb0d. Read the comment docs.

jferard commented 4 years ago

Thanks for the PR. There is definitely something here, but I'm not sure this is the answer. Have you succeeded to add a border to the end of a row (in blank cells) with your additional code?

Because appendRepeatedCell has really a bad name: it should be insertBlankCells or something like that, because it only add cells without any content or style. It exists only to skip blank cells between the cells with real content. Hence, adding such blank cells after the last cell with content will have no effect (I mean: in Calc display, because it will obviously add some tags to the XML file).

If you want to have blank cells with a style, you should write something like:

    walker.next();
    walker.setVoidValue(); // this is not a blank cell
    walker.setStyle(myStyle);

Note: I found a mistake in CellType (type and attribute are swaped), thanks to your PR.