I'd like to finish implementation and create a patch for BorderCodes. Currently it reads only the Word 97 structure (4-byte), and the class does not provide any getters or setters. Word 2000 and above use new 8-byte version, which is changed in new SPRM, which are currently not processed. I don't know how to do it best in regard of backward compatibility. Two BorderCode structures should be supported. They have the same properties, except for color, which is changed from 8-bit to 24-bit in word 2000. I suggest this: 1. rename existing BorderCode to BorderCode97 and create new BorderCode2000. These will read/write values as appropriate for particular version. 2. create new class BorderCode, which will delegete to BorderCode97 or BorderCode2000. Will provide method returning boolean as whether 8 or 24-bit color is valid. It will not contain following public methods from current implementation: - the public contructor - the toInt method As such it will not be full backwards compatible, but I think this is not the issue, as currently the class is useless. Note, that there are different BorderCode structures for Word 95 and Word 1.0, but as I understand, we do not support these. Please let me know.
Created attachment 26032 [details] Patch to support borders Attached is the patch created by following the instructions in the Contribution Guidelines. How it is implemented: - no support for Word 2000 structure of BorderCode. The only difference is that Word 2000 has 24-bit color while Word 97 version has only 16 colors. In my tests Word 2003 and 2007 saves both structures, so you are able to read it anyway. - get methods for borders were added to TableRow: for some strange reason TableRow extends Paragraph. Paragraph has getXxxBorder methods, but they return incorrect values, because they read from _props superclas's field instead of _tprops field Please give feedback or merge.
To answer the question - the TableXXXX classes extend from paragraph because in the file format they're really just paragraphs with special properties! In terms of table vs paragraph properties: For a table where the row has a border, and a paragraph in it has one, do we need to merge the two properties?
The patch looks good, thanks for that Any chance of a quick unit test for it? I guess we'll need a word file with a table in it, some rows with borders and some without. The test would then check each row in turn, and ensure that the borders show up / don't show up as expected. I'm happy to commit this to svn once we have a test to go with it
Created attachment 26128 [details] Patch to support borders (with testcase) Updated patch with a testcase.
Created attachment 26129 [details] Added files for the patch
Applied in r1005447 Thanks, Yegor