wie kann der aktuelle Inhalt der Zwischenablage in die Tabellenzelle, in der der Cursor gerade steht, eingefügt werden.
Im Moment verwende ich ein Makro, das Text in das Dokument einfügt. Das funktioniert aber nicht, wenn der Cursor in einer Tabellenzelle steht:
Code: Alles auswählen
Sub ImportClipboard
Dim oClip, oClipContents, oTypes
Dim oConverter, convertedString$
Dim i%, iPlainLoc%
iPlainLoc = -1
oClip = createUnoService("com.sun.star.datatransfer.clipboard.SystemClipboard")
oConverter = createUnoService("com.sun.star.script.Converter")
oClipContents = oClip.getContents()
oTypes = oClipContents.getTransferDataFlavors()
Dim msg$, iLoc%, outS
msg = ""
iLoc = -1
For i=LBound(oTypes) To UBound(oTypes)
If oTypes(i).MimeType = "text/plain;charset=utf-16" Then
iPlainLoc = i
Exit For
End If
'msg = msg & "Mime type = " & x(ii).MimeType & " normal = " & x(ii).HumanPresentableName & Chr$(10)
Next
If (iPlainLoc >= 0) Then
convertedString = oConverter.convertToSimpleType(oClipContents.getTransferData(oTypes(iPlainLoc)), com.sun.star.uno.TypeClass.STRING)
myDoc=thisComponent
myViewCursor=myDoc.GetCurrentController.ViewCursor
myViewCursor.String = convertedString
Else
MsgBox "Nichts zum Einfügen vorhanden"
End If
End Sub
Code: Alles auswählen
convertedString = oConverter.convertToSimpleType(oClipContents.getTransferData(oTypes(iPlainLoc)), com.sun.star.uno.TypeClass.STRING)
myDoc=thisComponent
myViewCursor=myDoc.GetCurrentController.ViewCursor
myViewCursor.String = convertedString
Dank und Gruß
polarbear
Moderation,4: ins zuständige Unterforum verschoben