Maybe realize it by macro, as just I do. If any, were like Paste Special as
Value.
Usage: First select your data in Excel, then place cursor where you want to
paste in Writer (table already were there, as same shape as copied data),
run macro.

Code of the macro as follow.

REM  *****  BASIC  *****
Sub Main
Dim oClip, oClipContents, oTypes
Dim oConverter, convertedString$
Dim oData
dim document   as object
dim dispatcher as object

sClipService = "com.sun.star.datatransfer.clipboard.SystemClipboard"
oClip = createUnoService(sClipService)
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
    oData = oClipContents.getTransferData(oTypes(i))
    convertedString = oConverter.convertToSimpleType(oData,
com.sun.star.uno.TypeClass.STRING)
  End If
Next

document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

dim args1(0) as new com.sun.star.beans.PropertyValue
dim args2(1) as new com.sun.star.beans.PropertyValue

args1(0).Name = "Text"

args2(0).Name = "Count"
args2(0).Value = 1
args2(1).Name = "Select"
args2(1).Value = false

aRows = Split(convertedString, Chr(13) & Chr(10))
iRows = UBound(aRows)
For i = 0 To iRows - 1
  aCells = Split(aRows(i), Chr(09))
  iCells = UBound(aCells)
  For j = 0 To iCells
    args1(0).Value = aCells(j)
     dispatcher.executeDispatch(document, ".uno:InsertText", "", 0, args1())
    If j = iCells Then
    Else
      dispatcher.executeDispatch(document, ".uno:GoRight", "", 0, args2())
    End If
  Next
  If i = iRows - 1 Then
  Else
    dispatcher.executeDispatch(document, ".uno:GoDown", "", 0, args2())
    For k = 1 To iCells
      dispatcher.executeDispatch(document, ".uno:GoLeft", "", 0, args2())
    Next
  End If
Next
End Sub
REM  *****  BASIC  *****


2010/8/9 David B Teague <[email protected]>

> I have an excel file that I have converted to a calc file. It contains
> membership data: names, addresses, email addresses etc. There are no
> formulas.
>
> I'd like to have this data in a table in an odt file. I do not know how to
> do this. If I do what seems reasonable: Select the part of the calc contents
> I want, copy and paste into the odt document, I get an image, as though I
> had made a screen shot. If I select and copy to a Thunderbird email message
> being composed, I get a table that I can copy, as a table on into a odt
> document. It seems reasonable that this should be possible directly.
>
> Is this possible? If so how do I do it?
>
> OO.org 3.2.1 Window XP SP 3 Sempron 2800+ (1.6 GHz) 1 GB RAM
>
> David Teague
>
>

Reply via email to