Hello Peter, we use JIRA as task tracking tool. Get a login, create a new enhancement/feature from https://issues.apache.org/jira/browse/ODFTOOLKIT Suggest the API or directly add a SVN patch of your suggested enhancement to the JIRA task.
Adding API is not such a problem as changing or removing it. Best regards, Svante ᐧ 2017-01-13 22:27 GMT+01:00 Peter Nabbefeld <[email protected]>: > Hello Svante, > > no problem, but I don't know how to add an enhancement request for this > project, but I do think, a high-level API should at least allow to set the > flow properties of an image. > > Kind regards > Peter > > > > Am 12.01.2017 um 21:48 schrieb Svante Schubert: > >> Hi Peter, >> >> The solution is indeed that you get from the Simple API layer to the >> ODFDOM >> layer. >> If this is not working you need to either add access from Simple API to >> ODFDOM layer or add the functionality to the Simple API level. >> We might add this to the library afterwards, just suggest a patch! :) >> >> As I said, I am not so familiar with the Simple API, but others might help >> if you get stucked or I might try it myself if you get lost ;) >> >> Good luck with it, >> Svante >> >> PS: I am sorry, the train ride was already packed with business stuff, so >> I >> was not able to fulfil my aim of assistance.. >> ᐧ >> >> 2017-01-12 12:59 GMT+01:00 Peter Nabbefeld <[email protected]>: >> >> Hello Svante, >>> >>> sorry, did't notice Your example code before, but I've tried sth. similar >>> already. >>> >>> The point is: I need to set "style:flow-with-text='false'". >>> >>> The Layout is as follows: >>> >>> 1) A headline at the beginning of the page. >>> 2) A table, containing 6 rows and 2 columns; first row merged. >>> 3) An image bound to the paragraph in the first table cell, spanning >>> about >>> 5 rows. >>> >>> With "style:flow-with-text='true'" (which is obviously the default >>> setting) the first row is expanded to fit to the bounds of the image, >>> which >>> is not the desired behaviour. >>> With "style:flow-with-text='false'" (which I cannot set using Simple API, >>> but only using ODFDOM layer directly), the table is correctly displayed, >>> but the image is in the background (so rows are visible in front of the >>> image). >>> >>> In my case, I've set the following properties to get my layout working: >>> String drawStyleName = image.getFrame().getDrawFrameE >>> lement().getDrawStyleNameAttribute(); >>> OdfStyle style = image.getOwnerDocument().getCo >>> ntentDom().getAutomaticStyles().getStyle(drawStyleName, >>> OdfStyleFamily.Graphic); >>> >>> style.setProperty(StyleGraphicPropertiesElement.Wrap, >>> StyleWrapAttribute.Value.RUN_THROUGH.toString()); >>> style.setProperty(StyleGraphicPropertiesElement.WrapInfluenceOnPosition, >>> DrawWrapInfluenceOnPositionAttribute.Value.ONCE_CONCURRENT.toString()); >>> style.setProperty(StyleGraphicPropertiesElement.RunThrough, >>> StyleRunThroughAttribute.Value.FOREGROUND.toString()); >>> style.setProperty(StyleGraphicPropertiesElement.Height, >>> "5.279cm"); >>> style.setProperty(StyleGraphicPropertiesElement.X, >>> StringUtils.toMetricAttribute(img.getX())); >>> style.setProperty(StyleGraphicPropertiesElement.Y, >>> StringUtils.toMetricAttribute(img.getX())); >>> style.setProperty(StyleGraphicPropertiesElement.Red, "3%"); >>> style.setProperty(StyleGraphicPropertiesElement.Green, "2%"); >>> style.setProperty(StyleGraphicPropertiesElement.Blue, "0%"); >>> style.setProperty(StyleGraphicPropertiesElement.Gamma, "95%"); >>> style.setProperty(StyleGraphicPropertiesElement.Clip, >>> "rect(1.82cm, 0cm, 0.91cm, 0cm)"); >>> style.setProperty(StyleGraphicPropertiesElement.FlowWithText, "false"); >>> >>> Most of those properties are not changeable via Simple API. >>> >>> Kind regards >>> Peter >>> >>> Am 11.01.2017 um 16:08 schrieb Svante Schubert: >>> >>> Hello Peter, >>>> >>>> Does the example helped you already? >>>> If not, can you sent a document (for example the one being generated) >>>> adjusted manuualy in LibreOffice with the image as you like to have it? >>>> >>>> Regards, >>>> Svante >>>> >>>> ᐧ >>>> >>>> 2017-01-11 12:23 GMT+01:00 Peter Nabbefeld <[email protected]>: >>>> >>>> Hello Svante, >>>> >>>>> my original problem was not inserting the image (that's been easy), but >>>>> setting the property - the image should not "explode" the table cell. >>>>> >>>>> My first appoach was creating a new StyleGraphicPropertiesElement >>>>> instance >>>>> - similar to some tutorial I've found about inserting tab stops. >>>>> >>>>> After I saw, it didn't work, I noticed there had already been such an >>>>> element in the style, which would have to be changed. I could achieve >>>>> editing the properties using ODFDOM, but not using Simple API. I've >>>>> also >>>>> looked into the sources, but the API has not been extended, yet. >>>>> >>>>> Kind regards >>>>> Peter >>>>> >>>>> >>>>> Am 11.01.2017 um 10:58 schrieb Svante Schubert: >>>>> >>>>> Hello Peter, >>>>> >>>>>> What was the original problem you like to solve? >>>>>> You started with inserting an image within the the paragraph of a >>>>>> cell. >>>>>> It works for me, I added an automated test for it, which is yet not >>>>>> testing >>>>>> just inserting the images, but it works. :) >>>>>> >>>>>> NOTE: I usually do not work on releases and I recommend to work on the >>>>>> latest sources, as I aim to use automated tests for all my fixes, I >>>>>> can >>>>>> be >>>>>> quite certain that the sources are better than the previous releases. >>>>>> As mentioned on http://incubator.apache.org/odftoolkit/source.html >>>>>> you may get the sources from by the following SVN comand: >>>>>> svn co https://svn.apache.org/repos/asf/incubator/odf/trunk >>>>>> odftoolkit20170111 >>>>>> >>>>>> NOTE: The best way to find a solution for a problem is to take a look >>>>>> into >>>>>> existing regression tests of the project you are focused on. >>>>>> As you are working on the simple API level you may find regression >>>>>> tests >>>>>> here: >>>>>> odftoolkit20170111/simple/src/test/java/org/odftoolkit/simple >>>>>> >>>>>> I combined two tests from the Simple API: >>>>>> One for the cell within a text table from >>>>>> >>>>>> odftoolkit20170111/simple/src/test/java/org/odftoolkit/simpl >>>>>> e/table/TableCellTest.java >>>>>> >>>>>> and one for the image: >>>>>> >>>>>> odftoolkit20170111/simple/src/test/java/org/odftoolkit/simpl >>>>>> e/common/navigation/ImageSelectionTest.java >>>>>> >>>>>> And appened the following test to one of those test files: >>>>>> >>>>>> @Test >>>>>> public void testGraphicStyle() { >>>>>> try { >>>>>> Table table1 = odtdoc.getTableByName("Table1"); >>>>>> Cell fcell2 = table1.getCellByPosition(0, 1); >>>>>> String text = fcell2.getDisplayText(); >>>>>> Assert.assertEquals("Aa\nbb\ncc\ndd\nee", text); >>>>>> >>>>>> // Caution there are two cells with the same content in >>>>>> the >>>>>> document.. >>>>>> Paragraph para = fcell2.getParagraphByIndex(0, true); >>>>>> Image image = null; >>>>>> image = Image.newImage(para, >>>>>> ResourceUtilities.getURI("testA.jpg")); >>>>>> image.setName("this image 1"); >>>>>> image.setHyperlink(new URI("http://odftoolkit.org")); >>>>>> >>>>>> // As I have overseen the image within the first >>>>>> table, I >>>>>> added >>>>>> a new paragraph (not in a table) to the end of the document and >>>>>> inserted >>>>>> the image there >>>>>> Paragraph para2 = odtdoc.addParagraph("MyImage"); >>>>>> Image image2 = null; >>>>>> image2 = Image.newImage(para2, >>>>>> ResourceUtilities.getURI("testA.jpg")); >>>>>> image2.setName("this image 2"); >>>>>> image2.setHyperlink(new URI("http://odftoolkit.org")); >>>>>> >>>>>> odtdoc.save(ResourceUtilities.newTestOutputFile("_newImageIn >>>>>> ParaCell.odt")); >>>>>> >>>>>> } catch (Exception ex) { >>>>>> >>>>>> Logger.getLogger(TableCellTest.class.getName()).log(Level.SEVERE, >>>>>> null, >>>>>> ex); >>>>>> } >>>>>> } >>>>>> >>>>>> By executing the test in an IDE with mouse context, you may run your >>>>>> new >>>>>> test solely to be able to debug some lines of interests. >>>>>> >>>>>> Finally, for reviewing the test resuslt, you may find the new created >>>>>> output document I called '_newImageInParaCell.odt' at >>>>>> odftoolkit20170111/simple/target/test-classes >>>>>> >>>>>> And to easily view into the zipped ODF document, I am using JEdit with >>>>>> the >>>>>> Archive extension and to indent the XML document the XML extension >>>>>> (that I >>>>>> aligned to a key short cut) making life much easier :) >>>>>> >>>>>> NOTE: that the Simple API was donated once by IBM, but when IBM >>>>>> withdrawn >>>>>> from Apache OpenOffice it withdraw from this project as well. I would >>>>>> need >>>>>> to debug myself, perhaps you can give it a try. >>>>>> Going to be on a train ride Thursday evening, if there are any >>>>>> question >>>>>> I >>>>>> may answer them at that time. >>>>>> >>>>>> Good luck! :) >>>>>> Svante >>>>>> >>>>>> 2017-01-10 23:04 GMT+01:00 Peter Nabbefeld <[email protected]>: >>>>>> >>>>>> Hello, >>>>>> >>>>>> I've found out now, that I'm duplicating the >>>>>>> StyleGraphicPropertiesElement. >>>>>>> >>>>>>> Using >>>>>>> GraphicProperties writableGraphicsProperties = >>>>>>> styleHandler.getGraphicPropertiesForWrite(); >>>>>>> I can get access to some very basic attributes, but the >>>>>>> StyleGraphicPropertiesElement is not accessible. >>>>>>> >>>>>>> How can I get it, so I don't have to create my own? >>>>>>> >>>>>>> Kind regards >>>>>>> Peter >>>>>>> >>>>>>> >>>>>>> >>>>>>> Am 10.01.2017 um 13:41 schrieb Peter Nabbefeld: >>>>>>> >>>>>>> Hello all, >>>>>>> >>>>>>> I'm new to this list, I've joined the list because I've seen the >>>>>>>> following misbehaviour related to images: >>>>>>>> >>>>>>>> In my document I add an image to a paragraph contained to a table >>>>>>>> cell: >>>>>>>> Image image = Image.newImage(para, new >>>>>>>> URI(imgParams.get("uri"))); >>>>>>>> >>>>>>>> FrameStyleHandler styleHandler = image.getStyleHandler(); >>>>>>>> OdfContentDom styles = para.getOwnerDocument().getCon >>>>>>>> tentDom(); >>>>>>>> StyleGraphicPropertiesElement gProperties = new >>>>>>>> StyleGraphicPropertiesElement(styles); >>>>>>>> [...] >>>>>>>> gProperties.setStyleFlowWithTextAttribute(false); >>>>>>>> writableStyleProperties.appendChild(gProperties); >>>>>>>> >>>>>>>> Though the property is set to "false", the resulting content >>>>>>>> includes >>>>>>>> the >>>>>>>> property as "true". I'm even more uncomfortable with this, as >>>>>>>> LibreOffice >>>>>>>> does not behave correctly after unsetting this property manually, >>>>>>>> but >>>>>>>> only >>>>>>>> after reloading. As I'm new to the toolkit, it's also possible that >>>>>>>> I've >>>>>>>> misconfigured sth. - If so, do You probably know what? >>>>>>>> >>>>>>>> Another problem I've noticed: When creating the odt file >>>>>>>> programmatically, I can open the properties dialog only for some >>>>>>>> "card >>>>>>>> tabs", but not for the image details alltogether. Do I have to do >>>>>>>> some >>>>>>>> special configuration? >>>>>>>> >>>>>>>> Kind regards >>>>>>>> Peter >>>>>>>> >>>>>>>> >>>>>>>> ᐧ >>>>>>>> >>>>>>> >>>>>> >
