openoffice-api mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "k.misha" <mi...@4k.com.ua>
Subject insert image into calc
Date Fri, 10 May 2013 13:37:29 GMT
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.

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

Something like this:

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

 

Thanks!


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