This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Django MS Excel Generator aims to create a template system for generation of the Excel documents for views (instead of HTML).

  1. Simple case: sniff model and make an excel table;
  2. Medium case: sniff model, make excel table, and apply predetermined styles (fonts, colors, layout)
  3. Advanced case: take models and set custom styles or modify existing


You have two options:

  1. Easy_insall with install the package and all dependencies if they aren’t already installed into your lib/python/:

    easy_install django_excel_templates
  2. Download and untar the package; run:

    python install


testobj in the following examples is django.db.models.query.QuerySet instance

Simple: create ExcelReport instance, add excel sheet, add queryset to analyze:

>>> from django_excel_templates import *
>>> report = ExcelReport()
>>> report.addSheet("TestBasic")
>>> report.addQuerySet(testobj, REPORT_HORZ, addheader=True)

Medium (create styles, one by one): create ExcelStyle instance to specify style (see help(ExcelStyle) for available methods and style options), create ExcelFormatter instance, add style to it:

>>> report.addSheet("TestStyle")
>>> style = ExcelStyle()
>>> style.set_alignment(horz=3, wrap=1)
>>> style.set_font(font_color='000000', bold=True, italic=True)
>>> style.set_border(border_color='000000', border_style=5)
>>> style.set_pattern(pattern_color='339933', pattern=1)
>>> formatter = ExcelFormatter()
>>> formatter.addBodyStyle(style=style)
>>> report.addFormatter(formatter)
>>> report.addQuerySet(testobj, orientation=REPORT_HORZ, addheader=True)

Medium (create styles all at once):

>>> report.addSheet("TestStyle2")
>>> headerstyle = ExcelStyle(font_color='00FF00', shadow=True, underline=True,
                             pattern_color='000000', pattern=1, border_style=5,
>>> col_style = ExcelStyle(font_color='FFFFFF')
>>> formatter.addHeaderStyle(headerstyle)
>>> formatter.addColunmStyle('column_name', style=col_style)
>>> report.addQuerySet(testobj, REPORT_HORZ, True)

Advanced: change existing styles, set custom styles, adjust column style and width:

>>> report.addSheet("ModifyStyle")
>>> style.set_font(font_color='000000', bold=False, underline=True)
>>> style.set_border(border_color='330099', border_style=6)
>>> style.set_pattern(pattern_color='FFFFFF', pattern=1)
>>> colstyle.set_pattern(pattern_color='FFFF33', pattern=1)
>>> formatter.setWidth('column1_name, column2_name', width=600)
>>> report.addQuerySet(testobj, REPORT_HORZ, True)

To make django.http.HttpResponse out of report and tell the broswer to treat it as an excel attachment:

>>> response = HttpResponse(report.writeReport(), mimetype='application/ms-excel')
>>> response['Content-Disposition'] = 'attachment; filename=foo.xls'
Release History

Release History


This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django_excel_templates-0.1.tar.gz (12.8 kB) Copy SHA256 Checksum SHA256 Source Nov 16, 2009

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting