Hello Günter
You can have a try on ODF Simple API.
Here is a simple jave codes:
SpreadsheetDocument sheet =
SpreadsheetDocument.newSpreadsheetDocument();
Table table = sheet.getTableList().get(0);
Cell cell = table.getCellByPosition(1, 1);
Image image4 = cell.setImage(new URI("psepptest.jpg"));
sheet.save(new File("c:\\imgesheetTest.ods"));
2012/10/31 Günter Mayer <[email protected]>
> Hello
>
> I'm sorry i used the wrong subject in my first mail. Sorry for that.
>
>
> I'm writing a seminar paper for the university. One of my tasks is to put
> an
> image into an .ods document.
> I'm trying to use a frame, because as i know the direct import into a cell
> is not possible.
>
> I write in ooRexx and via BSF4ooRexx i use the ODFDOM.
>
> My code looks as follows:
>
> clz=bsf.import("org.odftoolkit.odfdom.doc.OdfSpreadsheetDocument")
> outputOds=clz~newSpreadsheetDocument
> outputDom=outputOds~getContentDom()
>
>
>
> page=.bsf~new("org.odftoolkit.odfdom.dom.element.office.OfficeImageElement",
> outputDom)
>
> officesheet=outputOds~getContentRoot()
> sheet=officesheet~getFirstChild()
>
> frame=page~newDrawFrameElement()
>
> image=frame~newDrawImageElement()
> image~newImage(.bsf~new("java.net.URI","psepptest.jpg"))
>
> outputOds~save("test.ods")
>
> ::requires BSF.CLS
>
>
> The program creates the document but it's empty.
>
> So i think the connection between the ImageElement or the frame and the
> table is missing.
>
> But how to establish this connection?
>
> Does anybody has an idea how to do this, or any other method to import a
> picture into a spreadsheet document?
>
>
> Many thanks in advance
> Regards
> Günter
>
>