tfussell / xlnt

:bar_chart: Cross-platform user-friendly xlsx library for C++11+
Other
1.49k stars 418 forks source link

Question: How to Create & Copy to Clipboard (but do not save) #546

Closed Spammed closed 3 years ago

Spammed commented 3 years ago

Is it possible to build a workbook or a cell range and copy it to clipboard? Or: How would one implement something like that?

tfussell commented 3 years ago

What would you expect to be pasted after running this? A full XLSX file or just the CSV content? You could use xlnt to build or read a workbook in memory and write it to an array of bytes. You'd have to use a clipboard library to get the data into your clipboard. Here's one I found after a quick search https://github.com/dacap/clip

Spammed commented 3 years ago

I have to admit to not having thought about this well. I have now taken a look at the variety of formats that MS-Excel offers in the Windows clipboard. CSV is also among them :-)

At some point I would like my program to be able to exchange data with MS-Excel via the clipboard but without loss, i.e. without detour via a text representation like CSV.

We can close the topic until it (or I) become(s) more concrete. Thanks for your thoughts.

2021-02-09 16_35_46-Clipboard