~ubuntu-branches/debian/sid/xlsxwriter/sid

« back to all changes in this revision

Viewing changes to examples/hyperlink.py

  • Committer: Package Import Robot
  • Author(s): Zygmunt Krynicki
  • Date: 2014-04-29 12:25:12 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20140429122512-wqvuj4dumnfu4evx
Tags: 0.6.7-1
* New upstream release. List of changes is available on
  http://xlsxwriter.readthedocs.org/changes.html
* Add doc-base files for the readme.html shipped by upstream
* debian/control: build-depend on dh-python
* debian/watch: use the new pypi redirector
* debian/rules: don't ship the new vba_extract script, it's a small example
  (of many) and it doesn't seem to be that useful yet.
* debian/copyright: bump dates and add myself to debian/ section

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
#
3
3
# Example of how to use the XlsxWriter module to write hyperlinks
4
4
#
5
 
# Copyright 2013, John McNamara, jmcnamara@cpan.org
 
5
# Copyright 2013-2015, John McNamara, jmcnamara@cpan.org
6
6
#
7
7
import xlsxwriter
8
8
 
15
15
 
16
16
# Add the standard url link format.
17
17
url_format = workbook.add_format({
18
 
    'color':     'blue',
19
 
    'underline': 1
 
18
    'font_color': 'blue',
 
19
    'underline':  1
20
20
})
21
21
 
22
22
# Add a sample alternative link format.
23
23
red_format = workbook.add_format({
24
 
    'color':     'red',
25
 
    'bold':      1,
26
 
    'underline': 1,
27
 
    'size':      12,
 
24
    'font_color': 'red',
 
25
    'bold':       1,
 
26
    'underline':  1,
 
27
    'font_size':  12,
28
28
})
29
29
 
30
30
# Add an alternate description string to the URL.
34
34
tip = 'Get the latest Python news here.'
35
35
 
36
36
# Write some hyperlinks
37
 
worksheet.write('A1', 'http://www.python.org/')  # Implicit format.
38
 
worksheet.write('A3', 'http://www.python.org/', url_format, string)
39
 
worksheet.write('A5', 'http://www.python.org/', url_format, string, tip)
40
 
worksheet.write('A7', 'http://www.python.org/', red_format)
41
 
worksheet.write('A9', 'mailto:jmcnamaracpan.org', url_format, 'Mail me')
 
37
worksheet.write_url('A1', 'http://www.python.org/')  # Implicit format.
 
38
worksheet.write_url('A3', 'http://www.python.org/', url_format, string)
 
39
worksheet.write_url('A5', 'http://www.python.org/', url_format, string, tip)
 
40
worksheet.write_url('A7', 'http://www.python.org/', red_format)
 
41
worksheet.write_url('A9', 'mailto:jmcnamaracpan.org', url_format, 'Mail me')
42
42
 
43
43
# Write a URL that isn't a hyperlink
44
44
worksheet.write_string('A11', 'http://www.python.org/')