Mit dem Dispatcher kenne ich mich leider kein bisschen aus - aber schau mal, ob folgendes Makro nicht auch das Gewünschte tut:
Code: Alles auswählen
Sub InsertClipboard
Seperator = ";"
oDoc = thisComponent
If NOT oDoc.supportsService("com.sun.star.sheet.SpreadsheetDocument") Then Exit Sub
oSheet = oDoc.CurrentController.ActiveSheet
oSelection = oDoc.CurrentSelection(0)
If NOT oSelection.supportsService("com.sun.star.sheet.SheetCellRange") Then Exit Sub
oDoc.lockControllers
nStartRow = oSelection.RangeAddress.StartRow
nStartColumn = oSelection.RangeAddress.StartColumn
iPlainLoc = -1
oClip = createUnoService("com.sun.star.datatransfer.clipboard.SystemClipboard")
oConverter = createUnoService("com.sun.star.script.Converter")
oClipContents = oClip.getContents
oTypes = oClipContents.getTransferDataFlavors
For i=LBound(oTypes) To UBound(oTypes)
If oTypes(i).MimeType = "text/plain;charset=utf-16" Then
iPlainLoc = i
Exit For
End If
Next
If (iPlainLoc >= 0) Then
convertedString = oConverter.convertToSimpleType _
(oClipContents.getTransferData(oTypes(iPlainLoc)), com.sun.star.uno.TypeClass.STRING)
Dim aLine(0)
Dim aColumns(0)
aSplittedByLines = Split(convertedString,Chr(13))
For x = 0 To UBound(aSplittedByLines)
ReDim aColumns(0)
ReDim aLine(0)
aSplittedBySeperator = Split(aSplittedByLines(x),Seperator)
For z = 0 To UBound(aSplittedBySeperator)
ReDim Preserve aColumns(z)
aColumns(z) = aSplittedBySeperator(z)
Next z
aLine(0) = aColumns
oSheet.getCellRangeByPosition(nStartColumn,nStartRow+x,nStartColumn+z-1,nStartRow+x).setDataArray(aLine)
Next x
End If
Do While oDoc.hasControllersLocked
oDoc.unlockControllers
Loop
End Sub