problem pasting from Numbers

Do you have a typical platform dependent issue you're battling with ? Ask it here. Make sure you mention your platform, compiler, and wxWidgets version.
Post Reply
mihai
Earned a small fee
Earned a small fee
Posts: 18
Joined: Sun Aug 24, 2014 10:10 am

problem pasting from Numbers

Post 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
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: problem pasting from Numbers

Post 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.
Use the source, Luke!
mihai
Earned a small fee
Earned a small fee
Posts: 18
Joined: Sun Aug 24, 2014 10:10 am

Re: problem pasting from Numbers

Post 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,
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: problem pasting from Numbers

Post 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.
Use the source, Luke!
ONEEYEMAN
Part Of The Furniture
Part Of The Furniture
Posts: 7459
Joined: Sat Apr 16, 2005 7:22 am
Location: USA, Ukraine

Re: problem pasting from Numbers

Post by ONEEYEMAN »

Hi,
Check this and this links.

Thank you.
Post Reply