Open/Libre Office drag and drop MIME types
Does OpenOffice or LibreOffice support any mime types which allow direct pasting/drag'n'drop of tabular data? I have implemented CSV drag and drop, but since my source data is already tabular, I'd like my users to not have to navigate the import screen that co开发者_JAVA技巧mes up with CSV.
I had exactly the same problem. The solution is really stupid, and it cost me hours. Instead of formatting you csv table to:
One\tTwo\tThree\n
Four\tFive\tSix\n
Use the \r character instead on \n as:
One\tTwo\tThree\r
Four\tFive\tSix\r
The mimetype you have to use is "text/plain"
I tried dragging some cells from one OOo Calc window to another, and it maintains the tabular structure of my data, which suggests it does allow such things (but doesn't prove it: it could be doing something special behind the scenes).
(I thought there used to be a program to list the mime-types that a drag contained, but I can't find one today.)
On a whim, I tried dragging a simple <table>
from my web browser to OOo Calc, and it appeared there as a table, with no import screen. Based on this, I think that OOo sees a single <table>
in a text/html
data drop as something it knows how to put into cells.
I don't know if that's the best way but it seems to work!
精彩评论