Thursday, October 6, 2011

Re: weird behavoir of Excel

Hi Patrick,

As a quick fix, you can put "=" at the start of each field, and it should force the data to not 'auto format' (YMMV).

Cal

On Thu, Oct 6, 2011 at 10:13 AM, Szabo, Patrick (LNG-VIE) <patrick.szabo@lexisnexis.at> wrote:

Hi,

 

I'm creating an EXCEL-Sheet out of Django with the following code:

 

response = render_to_response('reportsexcel.html', {'produkte': dict(buch_pool), 'gesamt_string':gesamt_string} ,context_instance=RequestContext(request))

filename = "report.xls"

response['Content-Disposition'] = 'attachment; filename='+filename

response['Content-Type'] = 'application/vnd.ms-excel; charset=utf-8'

 

This works fine for the most part but there is a strange behaviour that i don't understand.

On the webpage i have a table that looks like this:

 

Produkt               10:20

Produkt2             04:30

 

Now in EXCEL this becomes

 

Produkt               10:20:00

Produkt2             04:30

 

This behaviour appears to be completely random.

 

Does anyone have an idea on how to controll this !?

 

I could create the sheet completly manual with xlwt but that seems a lot of coding for such a small task.

 

cheers

. . . . . . . . . . . . . . . . . . . . . . . . . .

Ing. Patrick Szabo
XSLT Developer

LexisNexis
Marxergasse 25, 1030 Wien

patrick.szabo@lexisnexis.at

Tel.: 00431 534521573

Fax: +43 (1) 534 52 - 146



--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment