JavaFX - Outlook attachments - DnD

核能气质少年 提交于 2019-12-24 00:39:19

问题


Hello i need a DnD Solution to Drag Outlook Mail Attachments to a Stackpane.

JavaFX / Outlook 2010

    stackpaneDragAndDropZone.setOnDragOver((DragEvent event) -> {
        Dragboard db = event.getDragboard();
        System.out.println(db.getContentTypes());
    });

Has this Output:

[[message/external-body;access-type=clipboard;index=0;name="faxdoc-150217-1300-+49-206581978.pdf"], [RenPrivateItem]]

How can i use this RenPrivateItem?

On regular Java i got a file with this code:

    dropTarget.addDropTargetListener(new DropTargetAdapter() {
        public void drop(DropTargetDropEvent dtde) {
            Transferable t = dtde.getTransferable();

            try {
                DataFlavor[] dataFlavors = t.getTransferDataFlavors();

                dtde.acceptDrop(DnDConstants.ACTION_COPY);

                //create a temp file
                File temp = File.createTempFile("temp-file-name", ".tmp");

                for (int i = 0; i < dataFlavors.length; i++) {
                    File file = new File(t.getTransferData(dataFlavors[i]).toString().replace("[", "").replace("]", ""));
                    Desktop.getDesktop().open(new File(file.getCanonicalPath()));
                }

                dtde.dropComplete(true);

            } catch (Exception ex) {

                ex.printStackTrace();

            }

        }

    });

回答1:


It is a private format as the name suggests. But you will get CF_FILEDESCRIPTOR and CF_FILECONTENTS formats.



来源:https://stackoverflow.com/questions/28562885/javafx-outlook-attachments-dnd

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!