Page 1 of 1

problem pasting from Numbers

Posted: Sun Sep 23, 2018 8:05 am
by mihai
Hi,

I develop an application which should paste some values from spreadsheet applications (like Excel, Numbers etc) to a grid.

The application works perfect except when copy-pasting from Numbers.
Pasting from Libre Office or Google Spreadsheet works with no problem.

Here is my code which I use to get data from Clipboard:

Code: Select all

if (wxTheClipboard->Open()){

        wxTextDataObject text_data;
		wxTheClipboard->GetData(text_data);
        
		wxString wx_copied_data(text_data.GetText());
		wxTheClipboard->Close();
}
Now, suppose that I have in Numbers a simple 2x2 table containing values:
100 200
300 400

When I paste them to my program I get the following string in wx_copied_data variable: L"\n100\n200\n300\n400\n\n"

As you can see there is no tab (\t) between values on the same row. Because of that it is impossible to know if the values are on the same row or on different rows.

If I paste from Libre Office I get the following value in wx_copied_data variable: L"100\t200\n300\t400\n"

which is perfect to parse (I have tab between values on the same row and new line between rows).

Any ideas how to properly handle pasting from Numbers?

thanks,
mihai

Re: problem pasting from Numbers

Posted: Sun Sep 23, 2018 8:39 am
by doublemax
Pasting from Libre Office or Google Spreadsheet works with no problem.
And which one doesn't work?

This sounds to me like the problem is in the source application and not in yours.

Use http://www.freeclipboardviewer.com to check what the clipboard actually contains.

Re: problem pasting from Numbers

Posted: Sun Sep 23, 2018 8:43 am
by mihai
doublemax wrote:
Pasting from Libre Office or Google Spreadsheet works with no problem.
And which one doesn't work?

This sounds to me like the problem is in the source application and not in yours.

Use http://www.freeclipboardviewer.com to check what the clipboard actually contains.

Pasting from Numbers (MacOS) does NOT work.
Libre Office, Google spreadsheet works (for MacOS & Windows).

regards,

Re: problem pasting from Numbers

Posted: Sun Sep 23, 2018 10:50 am
by doublemax
Ok, i didn't realize "Numbers" was the name of an app :)

Can you c/p from Numbers to Numbers and it preserves the row/column layout?

Try to find a clipboard viewer for OSX and check what the clipboard actually contains. Maybe it contains another data format that contains more information.

Re: problem pasting from Numbers

Posted: Mon Sep 24, 2018 3:58 pm
by ONEEYEMAN
Hi,
Check this and this links.

Thank you.