[PyQt] Paste entire column into QTableView from Excel
david at boddie.org.uk
Tue May 14 21:21:31 BST 2013
On Mon 13 May 2013 15:12:41 -0400, Mark Mordeca wrote:
> I am having an issue pasting into a QTableView from Excel when the user has
> copied by selecting an entire column in Excel, essentially putting every
> single row in the selected column, for the entire excel sheet, on the
> clipboard. The following is my paste code for QTableView:
> This all works fine when a user has selected just a bunch of cells in Excel
> and copied those. It breaks down when they select an entire column because
> pasteString then becomes upwards of 1048576 characters long (this value is
> found by printing pasteString.size() when highlighting a completely empty
> Excel column by selecting its header and copying). It completely kills the
Does it crash or just become unresponsive?
Is there a limit on the amount of data that can be stored in the clipboard
on Windows? Maybe that could be a factor. Can you paste the whole column into
another application successfully?
> Is there any way to get the copied column from the clipboard more
> efficiently than tab delimited text or something? Or should I just throw up
> an error when the size of the string on the clipboard is some arbitrarily
> large length? Any help would be appreciated.
You need to check what sort of MIME data is contained in the clipboard. The
QClipboard documentation should have example code for this.
More information about the PyQt