Have you ever hit a snag when trying to copy data to Windows clipboard? If you have, the capacity of the clipboard itself might not be the problem.
The question of Windows clipboard’s limits came up for one user who had a lot of data to move in this way.
ZDNet Recommends
Raymon Chen, a Windows veteran, has helped answer the question.
Basically, if you have struck a clipboard-related error that you think is because Windows clipboard itself reached its limit, you’re wrong.
“There is no pre-set maximum size for clipboard data,” explains Chen in a blogpost. “You are limited only by available memory and address space.”
SEE: The 10 best Windows laptops: Top notebooks, 2-in-1s, and ultraportables
Instead, this particular customer — who was trying to move 300,000 Excel rows using clipboard into another program — faced a data-format problem.
But clipboard was not the culprit. As Chen explains, in Win32, clipboard functions can be part of the solution. This particular program was returning a NULL when the Win32 GetClipboardData function was pulling the 300,000 rows of data from Excel.
It was not specifically the amount of data causing the NULL error, even though its size did affect the outcome. Instead, says Chen, it was because the program in question required data in Rich Text Format (RTF) — a format for text that Excel is not optimized for.
SEE: Microsoft launches Entra: A new identity and access family of products
So, the problem was not a limitation of Windows clipboard or even the hardware’s available memory, but rather Excel’s support for RTF, which caused the function to timeout as Excel failed in its attempt to complete the task within a certain timeframe.
“Excel does not operate natively in Rich Text Format. The Rich Text Format data that it places on the clipboard is delay-rendered,” explains Chen. “And then when another program asks for the Rich Text Format data, Excel says, “Oh yeah, just hang on a second, let me go get that for you.” Mind you, Rich Text Format is not the best format for a data table. As its name suggests, Rich Text Format is designed for text. It can represent basic tables, but that’s not its bread and butter.
“When the system asks a clipboard owner to render clipboard data, it sends the WM_RENDERFORMAT message and waits up to 30 seconds for it to return. If the clipboard owner fails to produce the data within 30 seconds, then system abandons the request, and GetClipboardData returns NULL.
“What’s happening is that this table is so large that it’s taking Excel longer than 30 seconds to produce the Rich Text Format table. The GetClipboardData function times out and returns NULL.”
Chen’s blogpost does offer a solution regarding clipboard ownership for those who find themselves confronted by a similar size and format issue when using large amounts of data from Excel using clipboard.