incubator-odf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Günter Mayer <h8952...@wu.ac.at>
Subject AW: ODFDOM image into ODS document
Date Thu, 01 Nov 2012 09:15:53 GMT
Hello Dali Liu
 
Thank you very much!!! 
This is exactly what I was looking for.
 
If somebody is interested in the ooRexx Code for importing a picture into a
Spredsheet document, mine looks like this:
 
clz=bsf.import("org.odftoolkit.simple.SpreadsheetDocument")
openOds=clz~newSpreadsheetDocument
odfTable=openOds~getTableList~get(0)
odfcell=odfTable~getCellByPosition(1,1)
odfcell~setImage(.bsf~new("java.net.URI","test.jpg"))
openOds~save("test.ods")
::requires BSF.CLS
 
Thank you very much
Best regards
Günter


  _____  

Von: Dali Liu [mailto:wawalovo@gmail.com] 
Gesendet: Donnerstag, 01. November 2012 03:33
An: odf-users@incubator.apache.org; h8952223@wu.ac.at
Betreff: Re: ODFDOM image into ODS document


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 <h8952223@wu.ac.at>


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





Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message