Hi Vineet,
I used xlwt for a non-production site and worked fine for me (just a
very simple report with a small formatting).
This is a quick example:
def excel_report():
from datetime import datetime
import xlwt
tmpfilename=os.path.join(request.folder,'private',str(uuid4()))
font0 = xlwt.Font()
font0.name = 'Arial'
font0.bold = True
style0 = xlwt.XFStyle()
style0.font = font0
style1 = xlwt.XFStyle()
style1.num_format_str = 'DD-MMMM-YYYY'
wb = xlwt.Workbook()
ws = wb.add_sheet('Sample report')
ws.write(0, 0, 'Text here', style0)
ws.write(0, 6, 'More text here', style0)
ws.write(0, 7, datetime.now(), style1)
wb.save(tmpfilename)
data = open(tmpfilename,"rb").read()
os.unlink(tmpfilename)
response.headers['Content-Type']='application/vnd.ms-excel'
return data
Hope it helps you.
Joaco.
Hi Dave,
how do you download the file? This method is an action in one controller, ie:
http://127.0.0.1:8000/myapp/printer/excel_report
and the file is downloaded as XLS.
Joaco.
Kenneth
> @selecta,
> thanks for directing to 'tablib'.
> It is also a good choice.
> I am assessing whether to use 'excel-python' or 'tablib'.
> :-|
>
Advantages :
- you don't have to build your Excel file in w2p (no extra module)
- you can link your data with different worksheets
- you can refresh data in Excel/OOo (manual or automatic)
- layout and formatting is preserved at each refresh
2011/7/20 Vineet <vineet....@gmail.com>:
--
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 a topic in the Google Groups "web2py-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/web2py/3IZ8uEAAXyU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.