How to trigger Download XLS button with Qt/C++ Webkit

How to trigger Download XLS button with Qt/C++ Webkit

BrochadinhoBrochadinho Posts: 4Questions: 0Answers: 0
edited November 2014 in Free community support

Hi

Im trying to do a bot that download a bunch of xls/csv files from a DataTable. Im using Qt webkit. I tried to usar click method just like any other html, but notting happens. I also tryed to debug the page to see what is the moment where the event of clicking a button is fired, but notthing happens.

c++ code:

QWebElement xlsBotaoDownload=ui->webView->page()->currentFrame()->findFirstElement("embed[id=ZeroClipboard_TableToolsMovie_1]");
xlsBotaoDownload.evaluateJavaScript("click()");

I expected that the code above to trigger the event of clicking the download of the file, but it doesn't. Does anyone know how get the csv or another way to get the data from the table?

Thanks

Luís Brochado

Replies

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin

    Are you able to emulate a click on a Flash element in Qt WebKit? I'd be a little surprised if that does work, but it isn't something I've ever tried I'm afraid.

    Allan

  • BrochadinhoBrochadinho Posts: 4Questions: 0Answers: 0

    on html i can, but on embed is zero! my idea is to instead of click() try some internal funtion of dataTables. But this is the first time that i'm working with it.

    Do you have some kind of sugestion how to get that dataTable? im trying the download of the file, but if i can get the datatable directly to my app it will work too.

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin

    It isn't a DataTables function as such, it is a Flash function that you need to trigger, as per my previous comment. Flash has security restrictions that require user interaction before a file can be saved to the local file system. I rather suspect Qt WebKit doesn't have a way around that, but you could ask in a Qt WebKit forum or IRC channel how to trigger a click event in Flash. I suspect you can't, but it isn't something I've tried.

    Allan

  • BrochadinhoBrochadinho Posts: 4Questions: 0Answers: 0

    thanks for the help.

    Btw, there is some public method of tables or ajax that i can execute from client side?

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin

    A method to do what? There isn't a public method for saving a local file - as I say, that is a Flash security restriction and not something I can circumvent.

    Allan

  • BrochadinhoBrochadinho Posts: 4Questions: 0Answers: 0

    Some method to get the data source of table. As far as i know, the flash just convert the data to one format and download. I just need to get the data. The transformation i can do it by my self.

    thanks for helping

  • allanallan Posts: 63,523Questions: 1Answers: 10,473 Site admin

    The data for the table? Use data() :-)

    Allan

This discussion has been closed.