Thanks a lot!<неиDo you have any examples in VS C++?<неи<неи<неи-----Original Message-----<неиFrom: Ariel Constenla-Haile [mailto:arie...@apache.org] <неиSent: Wednesday, May 08, 2013 6:58 PM<неиTo: api@openoffice.apache.org<неиSubject: Re: OO SDK<неи<неиHi k. misha,<неи<неиOn Wed, May 08, 2013 at 02:56:31PM +0300, k.misha wrote:<неи> Hi!<неи> <неи> <неи> <неи> How I can insert Image to a calc document using oo sdk 3.4.1?<неи<неи(Side note: please use descriptive subjects in the mails, something like "Inserting image in Calc")<неи<неиEach spreadsheet is described here:<неиhttp://www.openoffice.org/api/docs/common/ref/com/sun/star/sheet/Sp readsheet.html<неи<неиAs you can see, it supports ::com::sun::star::drawing::XDrawPageSupplier<неиThen:<неи<неи- access a spreadsheet<неи- get the draw page for this spreadsheet<неи- create a com.sun.star.drawing.GraphicObjectShape at the document<неи factory, set its size, position and graphic URL/css.graphic.XGraphic<неи- add the shape to the draw page.<неи<неиSample code in Basic:<неи<неиREM ***** BASIC *****<неи<неиSub Main<неи Dim oDoc as Object<неи oDoc = StarDesktop.loadComponentFromURL(_<неи "private:factory/scalc",_<неи "_default",_<неи 0,_<неи Array())<неи <неи Dim oGraphic as Object<неи Dim oGraphicProvider as Object<неи oGraphicProvider = CreateUnoService(_<неи "com.sun.star.graphic.GraphicProvider")<неи Dim aArgs(0) as new com.sun.star.beans.PropertyValue<неи aArgs(0).Name = "URL"<неи aArgs(0).Value = "private:graphicrepository/framework/res/backing.png"<неи oGraphic = oGraphicProvider.queryGraphic(aArgs)<неи <неи If IsNull(oGraphic) OR oGraphic.getType() = com.sun.star.graphic.GraphicType.EMPTY Then<неи Exit Sub<неи End If<неи Dim oSize100thMM as Object<неи oSize100thMM = oGraphic.Size100thMM<неи If oSize100thMM.Width = 0 OR oSize100thMM.Height = 0 Then<неи Dim oSizePixel as Object<неи oSizePixel = oGraphic.SizePixel<неи If oSizePixel.Width = 0 OR oSizePixel.Height = 0 Then<неи Exit Sub<неи End If<неи Dim oUnitConversion as Object<неи oUnitConversion = oDoc.getCurrentController().getFrame().getContainerWindow()<неи oSize100thMM = oUnitConversion.convertSizeToLogic(oSizePixel,com.sun.star.util.MeasureUnit. MM_100TH)<неи End If<неи <неи Dim oSheets as Object<неи Dim oSheet as Object<неи oSheets = oDoc.getSheets()<неи If NOT oSheets.hasElements() Then<неи 'ToDo insert one<неи Exit Sub<неи End If<неи oSheet = oSheets.getByIndex(0)<неи <неи Dim oDrawPage as Object<неи oDrawPage = oSheet.getDrawPage()<неи <неи Dim oGraphicShape as Object<неи oGraphicShape = oDoc.createInstance("com.sun.star.drawing.GraphicObjectShape")<неи <неи Dim oPoint as new com.sun.star.awt.Point<неи oPoint.X = 5000<неи oPoint.Y = 200<неи <неи With oGraphicShape<неи .setPosition(oPoint)<неи .setSize(oSize100thMM)<неи .Graphic = oGraphic<неи End With<неи oDrawPage.add(oGraphicShape)<неиEnd Sub<неи<неи<неиRegards<неи--<неиAriel Constenla-Haile<неиLa Plata, Argentina<неи
--------------------------------------------------------------------- To unsubscribe, e-mail: api-unsubscr...@openoffice.apache.org For additional commands, e-mail: api-h...@openoffice.apache.org