Subject: | Re: Cut and Paste - Table into Excel -
| Date: | 3 Aug 2018 23:50:57 -0400
| From: | "Kevin Zawicki" <numberjack@wi.rr.com>
| Newsgroups: | pnews.paradox-programming
|
I have worked with that library and some mods I made for a while. I have
tried to do what you want but often end up going cell by cell which is lowest
performance.
I have and limited other success with other techniques.
add a sheet, paste on sheet, select all, remove all grid formatting, paste
into desired sheet, some variation son this.
Write excel vba code to import from text, invoke the code via ole.
Also, I have been on a quest to find a OPAL example to use excel ole to sort
a sheet.
Robert MacMillan <macfam@bigpond.net.au> wrote:
>Thanks heaps modridirkac.
>
>This is one of those really frustrating Paradox and in this case OLE
>issues that once solved will remain solved forever. In the meantime much
>frustration.
>
>So if I use sel.Invoke("PasteSpecial")
>
>It does indeed paste. However it Pastes everything on the clipboard
>including the stuff that is not visible so all the horizontal and
>vertical bars one sees in a table so those are being stored on the
>Clipboard but are not visible.
>
>If I use sel.Invoke("Paste") ....... and am watching what is going on
>with the spreadsheet then the focus goes to the Paste Button which then
>waits for interaction. And will paste. So the focus is in the right spot
>in the spreadsheet. One can continue with the Paste using the down arrow
>on the Paste Button or Ctrl+V also pastes correctly.
>
>What I cant seem to do and I must be stupid because if "PasteSpecial"
>works then there must be a way to emulate the Ctrl+V command but I cant
>figure it out. Tried absolutely everything I can think of so far.
>
>Another one of those things which should be obvious but is not.
>
>Anyway. Thanks for the help and it was a huge help because it gets me to
>where all I have to do is figure what I am missing.
>
>Robert
>
>On 31/07/2018 5:41 PM, modridirkac wrote:
>> This code works for me.
>> You must have something in the clipboard, before calling this script.
>> You must also have an xls file in tem folder, to open it.
>>
>> This code opens OLE t oexcel, loads file (c:\temp\excel.xlsx) and pasts
>> to cells B5:C8
>> and shows final result in excel.
>>
>> const
>> ; Excel coord. types
>> xlA1 = 1 ; A1
>> xlR1C1 = - 4150 ; R1C1
>> endConst
>>
>> method run(var eventInfo Event)
>> ; paste from clipboard to excel
>> var excel OleAuto
>> Workbooks, sel OLEAuto
>> endVar
>> ; start excel
>> Excel.open("Excel.Application")
>> Excel.DisplayAlerts=false
>>
>> ; open file
>> Workbooks = Excel.Workbooks
>> if WorkBooks.count>0 then return endif
>> Workbooks.invoke("Open", "c:\\temp\\excel.xlsx")
>>
>> ; mark your range
>> s = Excel.convertFormula("B5:C8", xlA1, xlR1C1, True)
>> Excel.goto(s)
>> sel = Excel.Selection
>>
>> ; paste from clipboard to that selection
>> sel.Invoke("PasteSpecial")
>>
>> ; show the result
>> Excel.visible=true
>> endMethod
>>
>>
|