On Fri, 24 Mar 2006 10:40:58 -0600, WhiteWolf
<[EMAIL PROTECTED]> wrote:

Saludos,

    Estoy migrando un estudio de ingeniería y necesito poder poner, algo
equivalente en funcionalidad, un campo que ponga escrito "Plan de
frecuencias" y que al pulsarlo abra el diálogo para abrir un fichero e
insertarlo en esa posición. Al estilo de campos OLE, Tablas, etc... Los
que son "campos comodín".

Gracias.

Checa este documento:
http://www.pitonyak.org/AndrewMacro.odt

Y este snippet de codigo:

 1.1.1. Insert, size, and position a graphic in a Calc document.
David Woody [EMAIL PROTECTED] needed to insert a graphics object at a specific position at a specific size. With a little help and a lot of work, he developed the following solution: This reply took some time because I had another problem to solve with setting the correct value for the X and Y coordinates. The following code inserts a graphic, sizes it, and moves it to the desired location. I had to add the following line to the code in Andrew's macro book in section the section on setting bitmap size.
Dim aPosition As New com.sun.star.awt.Point
The other problem I had was that I had to determine the ratio that was needed for aPosition.X and aPosition.Y to properly position the graphic. On my computer the value of 2540 for either X or Y coordinate = 1 inch on the screen. The values below will put the graphic 1 inch down from the top of the sheet and 1 inch over from the left of the sheet.
Listing 5.74: Insert and position a graphic in a Calc document.
Sub InsertAndPositionGraphic
  REM Get the sheet
  Dim vSheet
  vSheet = ThisComponent.Sheets(0)

  REM Add the graphics object
  Dim oDesktop As Object, oDocument As Object
  Dim mNoArgs()
  Dim sGraphicURL As String
  Dim sGraphicService As String, sUrl As String
  Dim oDrawPages As Object, oDrawPage As Object
  Dim oGraphic As Object
sGraphicURL = "file:///usr/local/openoffice1.1RC/share/gallery/bullets/blkpearl.gif"
  sGraphicService = "com.sun.star.drawing.GraphicObjectShape"
  oDrawPage = vSheet.getDrawPage()
  oGraphic = ThisComponent.createInstance(sGraphicService)
  oGraphic.GraphicURL = sGraphicURL
  oDrawPage.add(oGraphic)

  REM Size the object
  Dim TheSize As New com.sun.star.awt.Size
  TheSize.width=400
  TheSize.height=400
  oGraphic.setsize(TheSize)

  REM Position the object
  Dim aPosition As New com.sun.star.awt.Point
  aPosition.X = 2540
  aPosition.Y = 2540
  oGraphic.setposition(aPosition)
End Sub

--
Alexandro Colorado
CoLeader of OpenOffice.org ES
http://es.openoffice.org

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Responder a