Hi,

k.misha schrieb:
Hello!

I have this code:

Reference< com::sun::star::drawing::XDrawPagesSupplier >
xDrawPagesSupplier(xCalcComponent, UNO_QUERY);

Reference< XDrawPages > xDrawPages( xDrawPagesSupplier->getDrawPages(),
UNO_QUERY );

Reference< XDrawPage > xDrawPage( xDrawPages->getByIndex(0), UNO_QUERY );

Reference< XShapes > xShapes(xDrawPage, UNO_QUERY);



com::sun::star::awt::Point imgPoint;

com::sun::star::awt::Size imgSize;



imgSize.Height = 5000;

imgSize.Width = 25000;

imgPoint.X = 6500;

imgPoint.Y = 8100;



Reference<XSpreadsheetDocument> xSheetDocument (xCalcComponent,UNO_QUERY);

Reference< XModel > aDrawDoc (xSheetDocument, UNO_QUERY);

Reference<XChartDocument> aChartDoc;

Reference<XMultiServiceFactory> aFact(aDrawDoc,UNO_QUERY);

Reference< XShape > xShape(
aFact->createInstance(OUString::createFromAscii("com.sun.star.drawing.OLE2Sh
ape")), UNO_QUERY);



xShape->setPosition(imgPoint);

xShape->setSize(imgSize);

xDrawPage->add(xShape);



This code inserts empty ole object into calc document with my imgSize and
imgPoint.

As far as I see, it inserts only a shape. You have to set the property CLSID to create the chart document itself. For a chart it is CLSID="12DCAE26-281F-416F-a234-c3086127382e"


But how can I set the image for this ole object?

You have to set the chart type and fill the data table or the reference to the data range of the spreadsheet. That should be in Model.


Something like this:

xShape->SetUrl("C:\\1.png") or xShape->SetImage("C:\\1.png").

I think, the picture should be generated automatically, but I'm not sure whether a kind of update/refresh is necessary.

Kind regards
Regina

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

Reply via email to