On Wednesday, November 22, 2017 at 1:46:06 PM UTC+1, Ramos wrote:
>
> Some questions ...
>
> 1 - i see that you have already a report_request table with the reports.
> Are you talking about this table to save reports? Looks to me that this 
> table is to save the "templates" of the pdf reports
>

this is a different table to temporarily store report definition and data. 
It is used as a workaround for the plugin. The data for pdf preview in MS 
Edge browser cannot be set directly and needs a url instead. Further this 
is also needed for xls preview, because there is no simple preview plugin 
for xls. Therefor the url for xls preview is opened in a new tab and 
handled by the browser.
 

> 2 - How do i merge data from my db with your templates and generate a live 
> pdf with live data? so users can save it in their desktop ?
>

in your web2py controller (where you generate the final pdf file) create a 
Report instance:
report = Report(report_definition, data)

where report_definition is the report template (the one you uploaded to 
your save controller), and data is a dict containing the actual data to 
fill in. the keys must match with your parameters of the report. E.g. if 
you have a parameter "first_name" then data must contain a key 
"first_name". You should check afterwards if there were any errors during 
report initialization (report.errors)

the report itself (pdf file) is created with
report_file = report.generate_pdf()


> regards
> António
>
> 2017-11-22 12:35 GMT+00:00 Alex <al...@jobsta.at <javascript:>>:
>
>> On Wednesday, November 22, 2017 at 12:07:56 PM UTC+1, Ramos wrote:
>>>
>>> Not that easy :)
>>>
>>> i´m reading your links and also this link
>>>
>>> https://github.com/jobsta/reportbro-designer/blob/master/demos/custom_save.html
>>>
>>> where i´m stuck in the save part
>>>
>>> what url do i put in the save url ?
>>>
>>
>> that's up to you. e.g.
>> '{{=URL('report', 'save')}}'
>> so you would need a controller file report.py with a function save in 
>> your application. There you have to save the report (available as data 
>> parameter) yourself wherever you want to. E.g. you could save it in your db 
>> or as a file.
>>
>> In your case you don't have the controller you specified in the url, 
>> therefor the ajax call fails.
>>  
>>
>>> [image: Imagem inline 1]
>>>
>>> i moved the run function from the reportbro_web2py.py to a controller 
>>> and i use it in the above "your save controller url" but i get a bad 
>>> request in the browser when i do in the console
>>> $('#reportbro').reportBro('save')
>>>
>>> Thank you
>>>
>>> -- 
>> Resources:
>> - http://web2py.com
>> - http://web2py.com/book (Documentation)
>> - http://github.com/web2py/web2py (Source code)
>> - https://code.google.com/p/web2py/issues/list (Report Issues)
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "web2py-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to web2py+un...@googlegroups.com <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to