demo.py :  » XML » pyXLWriter » pyXLWriter-0.4a3 » examples » Python Open Source

Home
Python Open Source
1.3.1.2 Python
2.Ajax
3.Aspect Oriented
4.Blog
5.Build
6.Business Application
7.Chart Report
8.Content Management Systems
9.Cryptographic
10.Database
11.Development
12.Editor
13.Email
14.ERP
15.Game 2D 3D
16.GIS
17.GUI
18.IDE
19.Installer
20.IRC
21.Issue Tracker
22.Language Interface
23.Log
24.Math
25.Media Sound Audio
26.Mobile
27.Network
28.Parser
29.PDF
30.Project Management
31.RSS
32.Search
33.Security
34.Template Engines
35.Test
36.UML
37.USB Serial
38.Web Frameworks
39.Web Server
40.Web Services
41.Web Unit
42.Wiki
43.Windows
44.XML
Python Open Source » XML » pyXLWriter 
pyXLWriter » pyXLWriter 0.4a3 » examples » demo.py
#!/usr/bin/env python
# This example script was ported from Perl Spreadsheet::WriteExcel module.
# The author of the Spreadsheet::WriteExcel module is John McNamara
# <jmcnamara@cpan.org>

__revision__ = """$Id: demo.py,v 1.11 2004/01/31 18:56:07 fufff Exp $"""

#######################################################################
#
# Demo of some of the features of Spreadsheet::WriteExcel.
# Used to create the project screenshot for Freshmeat.
#
#
# reverse('(c)'), October 2001, John McNamara, jmcnamara@cpan.org
#

import pyXLWriter as xl

workbook = xl.Writer("demo.xls")
worksheet = workbook.add_worksheet('Demo')
worksheet2 = workbook.add_worksheet('Another sheet')
worksheet3 = workbook.add_worksheet('And another')

#######################################################################
#
# Write a general heading
#
worksheet.set_column('A:B', 32)
heading  = workbook.add_format(bold = 1,
                               color = 'blue',
                               size = 18,
                               merge = 1,
                              )

headings = ('Features of Spreadsheet::WriteExcel', '')
worksheet.write_row('A1', headings, heading)

#######################################################################
#
# Some text examples
#
text_format = workbook.add_format(bold = 1,
                                   italic = 1,
                                   color = 'red',
                                   size = 18,
                                   font = 'Lucida Calligraphy'
                                  )

worksheet.write('A2', "Text")
worksheet.write('B2', "Hello Excel")
worksheet.write('A3', "Formatted text")
worksheet.write('B3', "Hello Excel", text_format)

#######################################################################
#
# Some numeric examples
#
num1_format = workbook.add_format(num_format='#,##0.00')
num2_format = workbook.add_format(num_format=' d mmmm yyy')

worksheet.write('A4', "Numbers")
worksheet.write('B4', 1234.56)
worksheet.write('A5', "Formatted numbers")
worksheet.write('B5', 1234.56, num1_format)
worksheet.write('A6', "Formatted numbers")
worksheet.write('B6', 37257, num2_format)

#######################################################################
#
# Formulae
#
worksheet.set_selection('B7')
worksheet.write('A7', 'Formulas and functions, "=SIN(PI()/4)"')
worksheet.write('B7', '=SIN(PI()/4)')

#######################################################################
#
# Hyperlinks
#
worksheet.write('A8', "Hyperlinks")
worksheet.write('B8',  'http://www.perl.com/' )

#######################################################################
#
# Images
#
worksheet.write('A9', "Images")
worksheet.insert_bitmap('B9', 'republic.bmp', 16, 8)

#######################################################################
#
# Misc
#
worksheet.write('A17', "Page/printer setup")
worksheet.write('A18', "Multiple worksheets")

workbook.close()
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.