Rui Lima wrote:
Thanks Fernand i've created the following sub

Sub ViewCursorGotoBookMark(ByVal aDocument As XComponent, ByVal
strBookMarkName As String)
       Dim MyBookMark As XTextContent
       MyBookMark = GetBookmarkByName(aDocument, strBookMarkName)
       Dim MyViewCursor As XTextViewCursor
       MyViewCursor = DirectCast(DirectCast(aDocument,
XTextDocument).getCurrentController, XTextViewCursorSupplier).getViewCursor
       MyViewCursor.gotoRange(MyBookMark.getAnchor(), False)
End Sub

Now it inserts at the bookmark position, Could you please tell me how can i
horizontally center the image on the page???

Cusors has a vertical and horizontal position
Images Has a number of pixels, keep in mind that OO uses 96 pixels per inch to show a picture (if you not diffend the demensions by youself.) To find out the original pixel dimensions in the picture, use the graphicprovider http://www.oooforum.org/forum/viewtopic.phtml?t=36724&highlight=graphicprovider The rest is quit simple: transfer pixels in mm and place them in the middel of your page





By the way  the use of the funtions, for the ones who needs is:
ViewCursorGotoBookMark(objDocument, "bkImage")
InsertImage(objDocument, strImagem, MyWidth, MyHeight)
Hope it helps others....

2007/2/13, Fernand Vanrie <[EMAIL PROTECTED]>:

have a look at


http://www.oooforum.org/forum/viewtopic.phtml?t=14348&highlight=bookmark+viewcursor
<
http://www.oooforum.org/forum/viewtopic.phtml?t=14348&highlight=bookmark+viewcursor
>

Rui Lima wrote:
> I have the following code to insert an embedded image on a WriterFile.
> The
> code is VB.NET
>
>
> Dim MyDispatcher As XDispatchHelper = MyMServiceFactory.createInstance("
> com.sun.star.frame.DispatchHelper")
> Dim MyProp(3) As unoidl.com.sun.star.beans.PropertyValue
> MyProp(0) = MakePropertyValue("FileName", strImgFileName)
> MyProp(1) = MakePropertyValue("AsLink", False)
> MyProp(2) = MakePropertyValue("Style", "Image")
>
> Dim an As unoidl.com.sun.star.frame.DispatchResultEvent = DirectCast(
> MyDispatcher.executeDispatch(aDocument.getCurrentController.getFrame,
> ".uno:InsertGraphic", "", 0, MyProp).Value,
> unoidl.com.sun.star.frame.DispatchResultEvent)
>
> Dim MyController As XController = aDocument.getCurrentController
> Dim MySelecionSupplier As XSelectionSupplier = DirectCast(MyController,
> XSelectionSupplier)
> Dim selection As uno.Any = MySelecionSupplier.getSelection
> Dim sel As unoidl.com.sun.star.drawing.XShape = selection.Value
>
> Dim strShapeType As String = sel.getShapeType
> ' Dim pos As unoidl.com.sun.star.awt.Point = sel.getPosition
> sel.setSize(New unoidl.com.sun.star.awt.Size(SizeWidth, SizeHeight))
>
>
> But i still have a problem with it... How can i set the position to a
> BookMark position???
>

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





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

Reply via email to