Hi,

In case the draw page from spreadsheet is used it is ok to export only the first shape from that page (as this first shape is the chart as it seems in this scenario). But different if you use the draw page of the chart. In that case it is wrong to only export the first shape. Try to use the draw page itself for export instead.

Hope that helps,
Ingrid

Am 26.05.10 11:00, Oleg Mikheev schrieb:
Hi!

Just checking if the mail list works or not.
The forwarded message was sent out one day ago - still
hasn't appeared on the list.
If you see this message we would be grateful if you could
(try to) answer the question.

Thanks!

-------- Original Message --------
Subject:        FW: Re: [graphics-dev] save chart image to file
Date:   Tue, 25 May 2010 13:51:11 +0400
From:   Doan Nguyen Van <ngvdoa...@yahoo.co.uk>
To:     'Oleg Mikheev' <omikh...@gmail.com>





*From:* Doan Nguyen Van [mailto:ngvdoa...@yahoo.co.uk]
*Sent:* Tuesday, May 25, 2010 13:46
*To:* 'dev@graphics.openoffice.org'
*Cc:* 'ingrid.hal...@sun.com'
*Subject:* Re: [graphics-dev] save chart image to file



On 02/24/10 10:10, Ingrid Halama wrote:

Hi,



What is the problem? In case you want to access the generated shapes
within the chart: The chart document supports interface
::com::sun::star::srawing::XDrawPageSupplier. The given draw page
contains generated draw shapes as well as persistent ones.





Hi Ingrid,



I’ve been able to get interface XDrawPage from a XChartDocument. But
when I export the shapes in the draw page, the exported image is empty.
May be it’s a bug of OpenOffice.org? My code for exporting is:



            XDrawPageSupplier drawPageSupplier =

                  UnoRuntime./queryInterface/(XDrawPageSupplier.*class*,
aChartDoc);

            XDrawPage drawPage = drawPageSupplier.getDrawPage();



            Object shapeAsObject = drawPage.getByIndex(0);

            XShape chartShape = (XShape)
UnoRuntime./queryInterface/(XShape.*class*, shapeAsObject);

            XComponent pageToExport = (XComponent)
UnoRuntime./queryInterface/(XComponent.*class*,

                              chartShape);



            //Create an exporter

            XExporter exporter = (XExporter)UnoRuntime./queryInterface/(

                              XExporter.*class*,


xMultiServiceFactory.createInstance("com.sun.star.drawing.GraphicExportFilter"));



            PropertyValue[] exportProperties = *new* PropertyValue[2];

            exportProperties[0] = *new* PropertyValue();

            exportProperties[0].Name = "MediaType";

            exportProperties[0].Value = "image/jpeg";



            exportProperties[1] = *new* PropertyValue();

            exportProperties[1].Name = "URL";

            exportProperties[1].Value = "file:///E:/Temp/Chart_OO.jpeg";



            exporter.setSourceDocument(pageToExport);

            XFilter drawFilter = (XFilter)
UnoRuntime./queryInterface/(XFilter.*class*, exporter);

            drawFilter.filter(exportProperties);



aChartDoc is a XChartDocument. With XDrawPage received from
XSpreadsheet, the above code perfectly works.



Thanks and best regards,

Doan Nguyen Van


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@graphics.openoffice.org
For additional commands, e-mail: dev-h...@graphics.openoffice.org




---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@graphics.openoffice.org
For additional commands, e-mail: dev-h...@graphics.openoffice.org

Reply via email to