Page 1 of 1

How to insert an image into a cell?

Posted: Thu Sep 12, 2013 9:42 am
by omurata
Hello everyone

I know that I use XCell.setFormula() to insert a string into a cell.

Please tell me how to insert an image into a cell.

Best regards
Tadashi Ohmura

Re: How to insert an image into a cell?

Posted: Thu Sep 12, 2013 9:48 am
by RoryOF
This thread suggests it may not be possible
http://forum.openoffice.org/en/forum/vi ... =9&t=62586

Re: How to insert an image into a cell?

Posted: Thu Sep 12, 2013 10:00 am
by omurata
Thank you for your answer, RoryOF

It is very regret.

Re: How to insert an image into a cell?

Posted: Thu Sep 12, 2013 11:45 am
by Zizi64
You can import images into a Calc document by macro code.

See these threads on another Forum:

http://www.oooforum.org/forum/viewtopic.phtml?t=132179
http://www.oooforum.org/forum/viewtopic.phtml?t=178847

and you can align pictures to the cells:
http://forum.openoffice.org/en/forum/vi ... =9&t=34544

Note:
...The images have not stored IN THE CELLS, but they are "stored" in a graphical layer of the sheet.

How to insert an image into a sheet by Java ?

Posted: Thu Sep 12, 2013 12:43 pm
by omurata
Thank you for your informations.

I have questions about how to insert an image into a sheet by Java.

I try to get com.sun.star.drawing.XDrawPage object :

Code: Select all

          com.sun.star.drawing.XDrawPagesSupplier xDPS =
              (XDrawPagesSupplier) UnoRuntime.queryInterface(
					com.sun.star.drawing.XDrawPagesSupplier.class, xComponent);
          com.sun.star.drawing.XDrawPages xDPn = xDPS.getDrawPages();
          com.sun.star.drawing.XDrawPage xDrawPage = null;
          com.sun.star.container.XIndexAccess xDPi =
              (XIndexAccess) UnoRuntime.queryInterface(
					com.sun.star.container.XIndexAccess.class, xDPn);
          xDrawPage = (XDrawPage) UnoRuntime.queryInterface(
              com.sun.star.drawing.XDrawPage.class, xDPi.getByIndex(0));
Please tell me what do I do next.

Re: How to insert an image into a cell?

Posted: Thu Sep 12, 2013 1:27 pm
by Zizi64
Sorry,
I am not familiar to Java, I am only familiar to Basic (StarBasic and others; and to Pascal/Delphi and to the Cpp a little bit...)

Re: How to insert an image into a cell?

Posted: Thu Sep 12, 2013 2:23 pm
by Zizi64
Here is a buggy, Java example code posted by 'ssureshkumar', Tue Mar 23, 2010 11:24 pm:

http://www.oooforum.org/forum/viewtopic.phtml?t=66545

Re: How to insert an image into a cell?

Posted: Thu Sep 12, 2013 2:45 pm
by omurata
Thank you for your help, Zizi64

It is regret that the code in thread "http://www.oooforum.org/forum/viewtopic.phtml?t=66545" does not work.