In addition, aside of setting the row height explicitly I believe we need as well set the following property to false: http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html#property-style_use-optimal-row-height i.e. call this.setUseOptimalHeight(false);
Best regards, Svante Am 20.02.2014 12:22, schrieb Svante Schubert: > Hi Nicholas, > > Thank you very much for this catch! > I had it on my list to look into it myself, as I wondered as well why > the height was never adjusted. > > Would you like to write an issue (reference to this mail as description > would be sufficient - ie. > https://mail-archives.apache.org/mod_mbox/incubator-odf-dev/201402.mbox/%3CCANgbAJjqEOPE%3DecCZwUVddbNm9DDhYsHs7OVRmBx6O_4h2XV8A%40mail.gmail.com%3E) > and add a patch - a regression test would be splendid! :) > I will review and push it after the release - unless anyone subjects and > would like it already in. > > More detailed answer below.. > > Am 20.02.2014 10:56, schrieb Nicholas Evans: >> Dear ODF-Devs, >> >> I have observed a problem with the setHeight() method of the Row class >> of the Simple API. >> When I use this method to set the height of a row, the row height does >> not change. This is because the associated <table:table-row> element >> does not have a table:style-name attribute that points to the desired >> style. >> >> Looking in the code for the setHeight method (in Row.java), I see that >> this attribute is removed before the property is set: >> >> maRowElement.removeAttributeNS(OdfDocumentNamespace.TABLE.getUri(), >> "style-name"); >> maRowElement.setProperty(rowHeightProp, sHeightIN); >> >> I have run a test (attached), and if I set the property without >> removing the style-name attribute then everything works as expected. >> >> Is there a reason this attribute is being removed? Comparing with the >> similar setColumnWidth method of the Column class, this removal of the >> attribute does not happen there. >> >> Should this call to removeAttributeNS be removed? >> > Yes, please remove it! The semantic would be otherwise that the set of > the height would clear the table from all other styles. > The change of a format property is in general seen as an change of this > property only. > > PS: Your attachments are more than half the way to a regression test. > You might want to change the name of the empty spreadsheet test document > to "empty.ods" and move your test method into the test folder (you might > even add it to an existing class - act on will) and reuse the load/save > mechanism of the tooling, aka: > static final String SOURCE = "empty.ods"; > static final String TARGET = "rowHeightTest.ods"; > > SpreadsheetDocument spreadsheet = > SpreadsheetDocument.loadDocument(ResourceUtilities.getTestResourceAsStream(SOURCE)); > //... > ResourceUtilities.newTestOutputFile(TARGET) > > I suggest the regression test would check if the value was correctly set. > > Many thanks, > Svante >> Thanks, >> Nick >>
