Hello community, here is the log from the commit of package python-XlsxWriter for openSUSE:Factory checked in at 2016-08-03 11:42:45 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-XlsxWriter (Old) and /work/SRC/openSUSE:Factory/.python-XlsxWriter.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-XlsxWriter" Changes: -------- --- /work/SRC/openSUSE:Factory/python-XlsxWriter/python-XlsxWriter.changes 2016-06-07 23:46:23.000000000 +0200 +++ /work/SRC/openSUSE:Factory/.python-XlsxWriter.new/python-XlsxWriter.changes 2016-08-03 11:42:47.000000000 +0200 @@ -1,0 +2,18 @@ +Fri Jul 22 16:23:41 UTC 2016 - [email protected] + +- Update to version 0.9.3 (changes since 0.8.7): + * Add workbook :func:`set_custom_property` method to set custom + document properties. + * Fix for :func:`insert_image` issue when handling images with + zero dpi. + * Add :ref:`trendline properties <chart_series_option_trendline>`: + ``intercept``, ``display_equation`` and ``display_r_squared``. + * Documented used of font rotation in chart :ref:`data labels + <chart_series_option_data_labels>`. + * Add workbook :func:`set_size` method to set the workbook window + size. + * Add check to :func:`add_table` to prevent duplicate header + names which leads to a corrupt Excel file. +- Fix SLE 11 build. + +------------------------------------------------------------------- Old: ---- XlsxWriter-0.8.7.tar.gz New: ---- XlsxWriter-0.9.3.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-XlsxWriter.spec ++++++ --- /var/tmp/diff_new_pack.Q39bzY/_old 2016-08-03 11:42:48.000000000 +0200 +++ /var/tmp/diff_new_pack.Q39bzY/_new 2016-08-03 11:42:48.000000000 +0200 @@ -17,7 +17,7 @@ Name: python-XlsxWriter -Version: 0.8.7 +Version: 0.9.3 Release: 0 Summary: Python module for writing OOXML spreadsheet files License: BSD-2-Clause @@ -26,12 +26,17 @@ Source: https://files.pythonhosted.org/packages/source/X/XlsxWriter/XlsxWriter-%{version}.tar.gz BuildRequires: python-devel BuildRequires: python-setuptools -Provides: python-xlsxwriter = %{version} -Obsoletes: python-xlsxwriter < %{version} Requires(post): update-alternatives Requires(postun): update-alternatives -BuildRoot: %{_tmppath}/%{name}-%{version}-build +# python-xlsxwriter was last used in openSUSE Leap 42.1. +Provides: python-xlsxwriter = %{version} +Obsoletes: python-xlsxwriter < %{version} +%if 0%{?suse_version} >= 1120 BuildArch: noarch +%else +BuildRoot: %{_tmppath}/%{name}-%{version}-build +%py_requires +%endif %description XlsxWriter is a Python module for writing files in the Microsoft @@ -46,30 +51,32 @@ python2 setup.py build %install -python2 setup.py install --root=%{buildroot} +python2 setup.py install \ + --root=%{buildroot} --prefix=%{_prefix} -# Prepare for update-alternatives usage +# Prepare for update-alternatives usage. mkdir -p %{buildroot}%{_sysconfdir}/alternatives -mv %{buildroot}%{_bindir}/vba_extract.py %{buildroot}%{_bindir}/vba_extract-%{py_ver} -ln -s -f %{_sysconfdir}/alternatives/vba_extract %{buildroot}%{_bindir}/vba_extract -# create a dummy target for /etc/alternatives/vba_extract +mv %{buildroot}%{_bindir}/vba_extract.py \ + %{buildroot}%{_bindir}/vba_extract-%{py_ver} +ln -sf %{_sysconfdir}/alternatives/vba_extract %{buildroot}%{_bindir}/vba_extract +# Create a dummy target for /etc/alternatives/vba_extract. touch %{buildroot}%{_sysconfdir}/alternatives/vba_extract %post -"%_sbindir/update-alternatives" \ +"%{_sbindir}/update-alternatives" \ --install %{_bindir}/vba_extract vba_extract %{_bindir}/vba_extract-%{py_ver} 30 %postun if [ $1 -eq 0 ] ; then - "%_sbindir/update-alternatives" --remove vba_extract %{_bindir}/vba_extract-%{py_ver} + "%{_sbindir}/update-alternatives" --remove vba_extract %{_bindir}/vba_extract-%{py_ver} fi %files %defattr(-,root,root) %doc Changes LICENSE.txt README.rst +%ghost %{_sysconfdir}/alternatives/vba_extract %{_bindir}/vba_extract %{_bindir}/vba_extract-%{py_ver} -%ghost %{_sysconfdir}/alternatives/vba_extract %{python_sitelib}/xlsxwriter/ %{python_sitelib}/XlsxWriter-%{version}-py*.egg-info ++++++ XlsxWriter-0.8.7.tar.gz -> XlsxWriter-0.9.3.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/XlsxWriter-0.8.7/Changes new/XlsxWriter-0.9.3/Changes --- old/XlsxWriter-0.8.7/Changes 2016-05-14 16:25:32.000000000 +0200 +++ new/XlsxWriter-0.9.3/Changes 2016-07-09 00:15:36.000000000 +0200 @@ -1,4 +1,50 @@ +Release 0.9.3 - July 8 2016 +--------------------------- + +* Added check to :func:`add_table` to prevent duplicate header names which + leads to a corrupt Excel file. + Issue `#362 <https://github.com/jmcnamara/XlsxWriter/issues/362>`_. + + +Release 0.9.2 - June 13 2016 +---------------------------- + +* Added workbook :func:`set_size` method to set the workbook window size. + + +Release 0.9.1 - June 8 2016 +--------------------------- + +* Added font support to chart :func:`set_table`. + +* Documented used of font rotation in chart :ref:`data labels + <chart_series_option_data_labels>`. + Issue `#337 <https://github.com/jmcnamara/XlsxWriter/issues/337>`_. + + +Release 0.9.0 - June 7 2016 +--------------------------- + +* Added :ref:`trendline properties <chart_series_option_trendline>`: + ``intercept``, ``display_equation`` and ``display_r_squared``. + Feature request `#357 <https://github.com/jmcnamara/XlsxWriter/issues/357>`_. + + +Release 0.8.9 - June 1 2016 +--------------------------- + +* Fix for :func:`insert_image` issue when handling images with zero dpi. + Issue `#356 <https://github.com/jmcnamara/XlsxWriter/issues/356>`_. + + +Release 0.8.8 - May 31 2016 +--------------------------- + +* Added workbook :func:`set_custom_property` method to set custom document + properties. + Feature request `#355 <https://github.com/jmcnamara/XlsxWriter/issues/355>`_. + Release 0.8.7 - May 13 2016 --------------------------- @@ -9,7 +55,7 @@ * Added :func:`get_worksheet_by_name()` method to allow the retrieval of a worksheet from a workbook via its name. -* Fixed issue where internal file creation and modification dates where in the +* Fixed issue where internal file creation and modification dates were in the local timezone instead of UTC. Release 0.8.6 - April 27 2016 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/XlsxWriter-0.8.7/MANIFEST.in new/XlsxWriter-0.9.3/MANIFEST.in --- old/XlsxWriter-0.8.7/MANIFEST.in 2015-03-16 02:40:57.000000000 +0100 +++ new/XlsxWriter-0.9.3/MANIFEST.in 1970-01-01 01:00:00.000000000 +0100 @@ -1,9 +0,0 @@ -include README.rst -include Changes -include LICENSE.txt -include xlsxwriter/*.py -include examples/*.py -include examples/*.txt -include examples/*.bin -include docs/readme.html -recursive-include docs/_static * diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/XlsxWriter-0.8.7/PKG-INFO new/XlsxWriter-0.9.3/PKG-INFO --- old/XlsxWriter-0.8.7/PKG-INFO 2016-05-14 16:58:24.000000000 +0200 +++ new/XlsxWriter-0.9.3/PKG-INFO 2016-07-09 15:06:15.000000000 +0200 @@ -1,6 +1,6 @@ Metadata-Version: 1.1 Name: XlsxWriter -Version: 0.8.7 +Version: 0.9.3 Summary: A Python module for creating Excel XLSX files. Home-page: https://github.com/jmcnamara/XlsxWriter Author: John McNamara diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/XlsxWriter-0.8.7/XlsxWriter.egg-info/PKG-INFO new/XlsxWriter-0.9.3/XlsxWriter.egg-info/PKG-INFO --- old/XlsxWriter-0.8.7/XlsxWriter.egg-info/PKG-INFO 2016-05-14 16:58:20.000000000 +0200 +++ new/XlsxWriter-0.9.3/XlsxWriter.egg-info/PKG-INFO 1970-01-01 01:00:00.000000000 +0100 @@ -1,87 +0,0 @@ -Metadata-Version: 1.1 -Name: XlsxWriter -Version: 0.8.7 -Summary: A Python module for creating Excel XLSX files. -Home-page: https://github.com/jmcnamara/XlsxWriter -Author: John McNamara -Author-email: [email protected] -License: BSD -Description: XlsxWriter - ========== - - **XlsxWriter** is a Python module for writing files in the Excel 2007+ XLSX - file format. - - XlsxWriter can be used to write text, numbers, formulas and hyperlinks to - multiple worksheets and it supports features such as formatting and many more, - including: - - * 100% compatible Excel XLSX files. - * Full formatting. - * Merged cells. - * Defined names. - * Charts. - * Autofilters. - * Data validation and drop down lists. - * Conditional formatting. - * Worksheet PNG/JPEG images. - * Rich multi-format strings. - * Cell comments. - * Integration with Pandas. - * Textboxes. - * Memory optimization mode for writing large files. - - It supports Python 2.5, 2.6, 2.7, 3.1, 3.2, 3.3, 3.4, 3.5, Jython and PyPy and - uses standard libraries only. - - Here is a simple example: - - .. code-block:: python - - import xlsxwriter - - - # Create an new Excel file and add a worksheet. - workbook = xlsxwriter.Workbook('demo.xlsx') - worksheet = workbook.add_worksheet() - - # Widen the first column to make the text clearer. - worksheet.set_column('A:A', 20) - - # Add a bold format to use to highlight cells. - bold = workbook.add_format({'bold': True}) - - # Write some simple text. - worksheet.write('A1', 'Hello') - - # Text with formatting. - worksheet.write('A2', 'World', bold) - - # Write some numbers, with row/column notation. - worksheet.write(2, 0, 123) - worksheet.write(3, 0, 123.456) - - # Insert an image. - worksheet.insert_image('B5', 'logo.png') - - workbook.close() - - .. image:: https://raw.github.com/jmcnamara/XlsxWriter/master/dev/docs/source/_images/demo.png - - See the full documentation at: http://xlsxwriter.readthedocs.org - - Release notes: http://xlsxwriter.readthedocs.org/changes.html - - -Platform: UNKNOWN -Classifier: Development Status :: 5 - Production/Stable -Classifier: License :: OSI Approved :: BSD License -Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 2.5 -Classifier: Programming Language :: Python :: 2.6 -Classifier: Programming Language :: Python :: 2.7 -Classifier: Programming Language :: Python :: 3.1 -Classifier: Programming Language :: Python :: 3.2 -Classifier: Programming Language :: Python :: 3.3 -Classifier: Programming Language :: Python :: 3.4 -Classifier: Programming Language :: Python :: 3.5 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/XlsxWriter-0.8.7/XlsxWriter.egg-info/SOURCES.txt new/XlsxWriter-0.9.3/XlsxWriter.egg-info/SOURCES.txt --- old/XlsxWriter-0.8.7/XlsxWriter.egg-info/SOURCES.txt 2016-05-14 16:58:24.000000000 +0200 +++ new/XlsxWriter-0.9.3/XlsxWriter.egg-info/SOURCES.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1,128 +0,0 @@ -Changes -LICENSE.txt -MANIFEST.in -README.rst -setup.cfg -setup.py -XlsxWriter.egg-info/PKG-INFO -XlsxWriter.egg-info/SOURCES.txt -XlsxWriter.egg-info/dependency_links.txt -XlsxWriter.egg-info/top_level.txt -docs/readme.html -docs/_static/basic.css -docs/_static/default.css -docs/_static/hello01.png -docs/_static/logo.png -docs/_static/pygments.css -examples/array_formula.py -examples/autofilter.py -examples/autofilter_data.txt -examples/cell_indentation.py -examples/chart.py -examples/chart_area.py -examples/chart_bar.py -examples/chart_clustered.py -examples/chart_column.py -examples/chart_combined.py -examples/chart_data_table.py -examples/chart_data_tools.py -examples/chart_date_axis.py -examples/chart_doughnut.py -examples/chart_gradient.py -examples/chart_line.py -examples/chart_pareto.py -examples/chart_pattern.py -examples/chart_pie.py -examples/chart_radar.py -examples/chart_scatter.py -examples/chart_secondary_axis.py -examples/chart_stock.py -examples/chart_styles.py -examples/chartsheet.py -examples/comments1.py -examples/comments2.py -examples/conditional_format.py -examples/context_manager.py -examples/data_validate.py -examples/datetimes.py -examples/defined_name.py -examples/demo.py -examples/diagonal_border.py -examples/doc_properties.py -examples/headers_footers.py -examples/hello_world.py -examples/hide_row_col.py -examples/hide_sheet.py -examples/http_server_py2.py -examples/http_server_py3.py -examples/hyperlink.py -examples/images.py -examples/images_bytesio.py -examples/macros.py -examples/merge1.py -examples/merge_rich_string.py -examples/outline.py -examples/outline_collapsed.py -examples/pandas_chart.py -examples/pandas_chart_columns.py -examples/pandas_chart_line.py -examples/pandas_chart_stock.py -examples/pandas_column_formats.py -examples/pandas_conditional_format.py -examples/pandas_datetime.py -examples/pandas_multiple.py -examples/pandas_positioning.py -examples/pandas_simple.py -examples/panes.py -examples/rich_strings.py -examples/right_to_left.py -examples/sparklines1.py -examples/sparklines2.py -examples/tab_colors.py -examples/tables.py -examples/text_indent.py -examples/textbox.py -examples/tutorial1.py -examples/tutorial2.py -examples/tutorial3.py -examples/unicode_polish_utf8.py -examples/unicode_polish_utf8.txt -examples/unicode_python2.py -examples/unicode_python3.py -examples/unicode_shift_jis.py -examples/unicode_shift_jis.txt -examples/vbaProject.bin -examples/vba_extract.py -examples/worksheet_protection.py -xlsxwriter/__init__.py -xlsxwriter/app.py -xlsxwriter/chart.py -xlsxwriter/chart_area.py -xlsxwriter/chart_bar.py -xlsxwriter/chart_column.py -xlsxwriter/chart_doughnut.py -xlsxwriter/chart_line.py -xlsxwriter/chart_pie.py -xlsxwriter/chart_radar.py -xlsxwriter/chart_scatter.py -xlsxwriter/chart_stock.py -xlsxwriter/chartsheet.py -xlsxwriter/comments.py -xlsxwriter/compat_collections.py -xlsxwriter/compatibility.py -xlsxwriter/contenttypes.py -xlsxwriter/core.py -xlsxwriter/drawing.py -xlsxwriter/format.py -xlsxwriter/packager.py -xlsxwriter/relationships.py -xlsxwriter/shape.py -xlsxwriter/sharedstrings.py -xlsxwriter/styles.py -xlsxwriter/table.py -xlsxwriter/theme.py -xlsxwriter/utility.py -xlsxwriter/vml.py -xlsxwriter/workbook.py -xlsxwriter/worksheet.py -xlsxwriter/xmlwriter.py \ No newline at end of file diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/XlsxWriter-0.8.7/XlsxWriter.egg-info/dependency_links.txt new/XlsxWriter-0.9.3/XlsxWriter.egg-info/dependency_links.txt --- old/XlsxWriter-0.8.7/XlsxWriter.egg-info/dependency_links.txt 2016-05-14 16:58:20.000000000 +0200 +++ new/XlsxWriter-0.9.3/XlsxWriter.egg-info/dependency_links.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/XlsxWriter-0.8.7/XlsxWriter.egg-info/top_level.txt new/XlsxWriter-0.9.3/XlsxWriter.egg-info/top_level.txt --- old/XlsxWriter-0.8.7/XlsxWriter.egg-info/top_level.txt 2016-05-14 16:58:20.000000000 +0200 +++ new/XlsxWriter-0.9.3/XlsxWriter.egg-info/top_level.txt 1970-01-01 01:00:00.000000000 +0100 @@ -1 +0,0 @@ -xlsxwriter diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/XlsxWriter-0.8.7/examples/chart_scatter.py new/XlsxWriter-0.9.3/examples/chart_scatter.py --- old/XlsxWriter-0.8.7/examples/chart_scatter.py 2016-01-12 22:33:19.000000000 +0100 +++ new/XlsxWriter-0.9.3/examples/chart_scatter.py 2016-05-23 00:20:52.000000000 +0200 @@ -149,7 +149,7 @@ chart4.set_style(14) # Insert the chart into the worksheet (with an offset). -worksheet.insert_chart('D51', chart4, {'x_offset': 25, 'y_offset': 10}) +worksheet.insert_chart('D50', chart4, {'x_offset': 25, 'y_offset': 10}) ####################################################################### # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/XlsxWriter-0.8.7/setup.cfg new/XlsxWriter-0.9.3/setup.cfg --- old/XlsxWriter-0.8.7/setup.cfg 2016-05-14 16:58:24.000000000 +0200 +++ new/XlsxWriter-0.9.3/setup.cfg 2014-10-10 00:55:11.000000000 +0200 @@ -1,8 +1,3 @@ [wheel] universal = 1 -[egg_info] -tag_build = -tag_date = 0 -tag_svn_revision = 0 - diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/XlsxWriter-0.8.7/setup.py new/XlsxWriter-0.9.3/setup.py --- old/XlsxWriter-0.8.7/setup.py 2016-05-14 16:36:55.000000000 +0200 +++ new/XlsxWriter-0.9.3/setup.py 2016-07-09 00:38:55.000000000 +0200 @@ -28,7 +28,7 @@ setup( name='XlsxWriter', - version='0.8.7', + version='0.9.3', author='John McNamara', author_email='[email protected]', url='https://github.com/jmcnamara/XlsxWriter', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/XlsxWriter-0.8.7/xlsxwriter/__init__.py new/XlsxWriter-0.9.3/xlsxwriter/__init__.py --- old/XlsxWriter-0.8.7/xlsxwriter/__init__.py 2016-05-14 16:36:55.000000000 +0200 +++ new/XlsxWriter-0.9.3/xlsxwriter/__init__.py 2016-07-09 00:38:55.000000000 +0200 @@ -1,3 +1,3 @@ -__version__ = '0.8.7' +__version__ = '0.9.3' __VERSION__ = __version__ from .workbook import Workbook diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/XlsxWriter-0.8.7/xlsxwriter/chart.py new/XlsxWriter-0.9.3/xlsxwriter/chart.py --- old/XlsxWriter-0.8.7/xlsxwriter/chart.py 2016-04-20 01:08:05.000000000 +0200 +++ new/XlsxWriter-0.9.3/xlsxwriter/chart.py 2016-06-07 22:31:15.000000000 +0200 @@ -470,6 +470,7 @@ table['vertical'] = options.get('vertical', 1) table['outline'] = options.get('outline', 1) table['show_keys'] = options.get('show_keys', 0) + table['font'] = self._convert_font_args(options.get('font')) self.table = table @@ -3138,6 +3139,21 @@ # Write the c:backward element. self._write_backward(trendline.get('backward')) + if 'intercept' in trendline: + # Write the c:intercept element. + self._write_c_intercept(trendline['intercept']) + + if trendline.get('display_r_squared'): + # Write the c:dispRSqr element. + self._write_c_disp_rsqr() + + if trendline.get('display_equation'): + # Write the c:dispEq element. + self._write_c_disp_eq() + + # Write the c:trendlineLbl element. + self._write_c_trendline_lbl() + self._xml_end_tag('c:trendline') def _write_trendline_type(self, val): @@ -3191,6 +3207,45 @@ self._xml_empty_tag('c:backward', attributes) + def _write_c_intercept(self, val): + # Write the <c:intercept> element. + attributes = [('val', val)] + + self._xml_empty_tag('c:intercept', attributes) + + def _write_c_disp_eq(self): + # Write the <c:dispEq> element. + attributes = [('val', 1)] + + self._xml_empty_tag('c:dispEq', attributes) + + def _write_c_disp_rsqr(self): + # Write the <c:dispRSqr> element. + attributes = [('val', 1)] + + self._xml_empty_tag('c:dispRSqr', attributes) + + def _write_c_trendline_lbl(self): + # Write the <c:trendlineLbl> element. + self._xml_start_tag('c:trendlineLbl') + + # Write the c:layout element. + self._write_layout(None, None) + + # Write the c:numFmt element. + self._write_trendline_num_fmt() + + self._xml_end_tag('c:trendlineLbl') + + def _write_trendline_num_fmt(self): + # Write the <c:numFmt> element. + attributes = [ + ('formatCode', 'General'), + ('sourceLinked', 0), + ] + + self._xml_empty_tag('c:numFmt', attributes) + def _write_hi_low_lines(self): # Write the <c:hiLowLines> element. hi_low_lines = self.hi_low_lines @@ -3523,6 +3578,10 @@ # Write the c:showKeys element. self._write_show_keys() + if table['font']: + # Write the table font. + self._write_tx_pr(None, table['font']) + self._xml_end_tag('c:dTable') def _write_show_horz_border(self): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/XlsxWriter-0.8.7/xlsxwriter/compatibility.py new/XlsxWriter-0.9.3/xlsxwriter/compatibility.py --- old/XlsxWriter-0.8.7/xlsxwriter/compatibility.py 2016-01-12 22:32:03.000000000 +0100 +++ new/XlsxWriter-0.9.3/xlsxwriter/compatibility.py 2016-05-29 19:21:28.000000000 +0200 @@ -31,9 +31,11 @@ # Types to check in Python 2/3. if sys.version_info[0] == 2: + int_types = (int, long) num_types = (float, int, long, Decimal, Fraction) str_types = basestring else: + int_types = (int) num_types = (float, int, Decimal, Fraction) str_types = str diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/XlsxWriter-0.8.7/xlsxwriter/contenttypes.py new/XlsxWriter-0.9.3/xlsxwriter/contenttypes.py --- old/XlsxWriter-0.8.7/xlsxwriter/contenttypes.py 2016-01-12 22:32:03.000000000 +0100 +++ new/XlsxWriter-0.9.3/xlsxwriter/contenttypes.py 2016-05-29 16:50:07.000000000 +0200 @@ -150,6 +150,11 @@ self._add_default(('bin', 'application/vnd.ms-office.vbaProject')) + def _add_custom_properties(self): + # Add the custom properties to the ContentTypes overrides. + self._add_override(('/docProps/custom.xml', + app_document + 'custom-properties+xml')) + ########################################################################### # # XML methods. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/XlsxWriter-0.8.7/xlsxwriter/custom.py new/XlsxWriter-0.9.3/xlsxwriter/custom.py --- old/XlsxWriter-0.8.7/xlsxwriter/custom.py 1970-01-01 01:00:00.000000000 +0100 +++ new/XlsxWriter-0.9.3/xlsxwriter/custom.py 2016-05-29 19:13:28.000000000 +0200 @@ -0,0 +1,140 @@ +############################################################################### +# +# Custom - A class for writing the Excel XLSX Custom Property file. +# +# Copyright 2013-2016, John McNamara, [email protected] +# + +# Package imports. +from . import xmlwriter + + +class Custom(xmlwriter.XMLwriter): + """ + A class for writing the Excel XLSX Custom Workbook Property file. + + + """ + + ########################################################################### + # + # Public API. + # + ########################################################################### + + def __init__(self): + """ + Constructor. + + """ + + super(Custom, self).__init__() + + self.properties = [] + self.pid = 1 + + def _set_properties(self, properties): + # Set the document properties. + self.properties = properties + + ########################################################################### + # + # Private API. + # + ########################################################################### + + def _assemble_xml_file(self): + # Assemble and write the XML file. + + # Write the XML declaration. + self._xml_declaration() + + self._write_properties() + + self._xml_end_tag('Properties') + + # Close the file. + self._xml_close() + + ########################################################################### + # + # XML methods. + # + ########################################################################### + + def _write_properties(self): + # Write the <Properties> element. + schema = 'http://schemas.openxmlformats.org/officeDocument/2006/' + xmlns = schema + 'custom-properties' + xmlns_vt = schema + 'docPropsVTypes' + + attributes = [ + ('xmlns', xmlns), + ('xmlns:vt', xmlns_vt), + ] + + self._xml_start_tag('Properties', attributes) + + for custom_property in self.properties: + # Write the property element. + self._write_property(custom_property) + + def _write_property(self, custom_property): + # Write the <property> element. + + fmtid = '{D5CDD505-2E9C-101B-9397-08002B2CF9AE}' + + name, value, property_type = custom_property + self.pid += 1 + + attributes = [ + ('fmtid', fmtid), + ('pid', self.pid), + ('name', name), + ] + + self._xml_start_tag('property', attributes) + + if property_type == 'number_int': + # Write the vt:i4 element. + self._write_vt_i4(value) + elif property_type == 'number': + # Write the vt:r8 element. + self._write_vt_r8(value) + elif property_type == 'date': + # Write the vt:filetime element. + self._write_vt_filetime(value) + elif property_type == 'bool': + # Write the vt:bool element. + self._write_vt_bool(value) + else: + # Write the vt:lpwstr element. + self._write_vt_lpwstr(value) + + self._xml_end_tag('property') + + def _write_vt_lpwstr(self, value): + # Write the <vt:lpwstr> element. + self._xml_data_element('vt:lpwstr', value) + + def _write_vt_filetime(self, value): + # Write the <vt:filetime> element. + self._xml_data_element('vt:filetime', value) + + def _write_vt_i4(self, value): + # Write the <vt:i4> element. + self._xml_data_element('vt:i4', value) + + def _write_vt_r8(self, value): + # Write the <vt:r8> element. + self._xml_data_element('vt:r8', value) + + def _write_vt_bool(self, value): + # Write the <vt:bool> element. + + if value: + value = 'true' + else: + value = 'false' + + self._xml_data_element('vt:bool', value) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/XlsxWriter-0.8.7/xlsxwriter/packager.py new/XlsxWriter-0.9.3/xlsxwriter/packager.py --- old/XlsxWriter-0.8.7/xlsxwriter/packager.py 2016-05-14 16:42:44.000000000 +0200 +++ new/XlsxWriter-0.9.3/xlsxwriter/packager.py 2016-05-29 16:51:36.000000000 +0200 @@ -18,6 +18,7 @@ from xlsxwriter.app import App from xlsxwriter.contenttypes import ContentTypes from xlsxwriter.core import Core +from xlsxwriter.custom import Custom from xlsxwriter.relationships import Relationships from xlsxwriter.sharedstrings import SharedStrings from xlsxwriter.styles import Styles @@ -138,6 +139,7 @@ self._write_shared_strings_file() self._write_app_file() self._write_core_file() + self._write_custom_file() self._write_content_types_file() self._write_styles_file() self._write_theme_file() @@ -328,6 +330,18 @@ core._set_xml_writer(self._filename('docProps/core.xml')) core._assemble_xml_file() + def _write_custom_file(self): + # Write the custom.xml file. + properties = self.workbook.custom_properties + custom = Custom() + + if not len(properties): + return + + custom._set_properties(properties) + custom._set_xml_writer(self._filename('docProps/custom.xml')) + custom._assemble_xml_file() + def _write_content_types_file(self): # Write the ContentTypes.xml file. content = ContentTypes() @@ -366,6 +380,10 @@ if self.workbook.vba_project: content._add_vba_project() + # Add the custom properties if present. + if self.workbook.custom_properties: + content._add_custom_properties() + content._set_xml_writer(self._filename('[Content_Types].xml')) content._assemble_xml_file() @@ -424,12 +442,19 @@ rels = Relationships() rels._add_document_relationship('/officeDocument', 'xl/workbook.xml') + rels._add_package_relationship('/metadata/core-properties', 'docProps/core.xml') + rels._add_document_relationship('/extended-properties', 'docProps/app.xml') + if self.workbook.custom_properties: + rels._add_document_relationship('/custom-properties', + 'docProps/custom.xml') + rels._set_xml_writer(self._filename('_rels/.rels')) + rels._assemble_xml_file() def _write_workbook_rels_file(self): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/XlsxWriter-0.8.7/xlsxwriter/workbook.py new/XlsxWriter-0.9.3/xlsxwriter/workbook.py --- old/XlsxWriter-0.8.7/xlsxwriter/workbook.py 2016-05-11 00:58:23.000000000 +0200 +++ new/XlsxWriter-0.9.3/xlsxwriter/workbook.py 2016-06-13 01:16:07.000000000 +0200 @@ -15,7 +15,7 @@ from zipfile import ZipFile, ZIP_DEFLATED from struct import unpack -from .compatibility import str_types, force_unicode +from .compatibility import int_types, num_types, str_types, force_unicode # Package imports. from . import xmlwriter @@ -97,6 +97,7 @@ self.named_ranges = [] self.custom_colors = [] self.doc_properties = {} + self.custom_properties = [] self.createtime = datetime.utcnow() self.num_vml_files = 0 self.num_comment_files = 0 @@ -295,6 +296,29 @@ self.fileclosed = 1 self._store_workbook() + def set_size(self, width, height): + """ + Set the size of a workbook window. + + Args: + width: Width of the window in pixels. + height: Height of the window in pixels. + + Returns: + Nothing. + + """ + # Convert the width/height to twips at 96 dpi. + if width: + self.window_width = int(width * 1440 / 96) + else: + self.window_width = 16095 + + if height: + self.window_height = int(height * 1440 / 96) + else: + self.window_height = 9660 + def set_properties(self, properties): """ Set the document properties such as Title, Author etc. @@ -308,6 +332,52 @@ """ self.doc_properties = properties + def set_custom_property(self, name, value, property_type=None): + """ + Set a custom document property. + + Args: + name: The name of the custom property. + value: The value of the custom property. + property_type: The type of the custom property. Optional. + + Returns: + Nothing. + + """ + if name is None or value is None: + warn("The name and value parameters must be non-None in " + "set_custom_property()") + return -1 + + if property_type is None: + # Determine the property type from the Python type. + if isinstance(value, bool): + property_type = 'bool' + elif isinstance(value, datetime): + property_type = 'date' + elif isinstance(value, int_types): + property_type = 'number_int' + elif isinstance(value, num_types): + property_type = 'number' + else: + property_type = 'text' + + if property_type == 'date': + value = value.strftime("%Y-%m-%dT%H:%M:%SZ") + + if property_type == 'text' and len(value) > 255: + warn("Length of 'value' parameter exceeds Excel's limit of 255 " + "characters in set_custom_property(): '%s'" % + force_unicode(value)) + + if len(name) > 255: + warn("Length of 'name' parameter exceeds Excel's limit of 255 " + "characters in set_custom_property(): '%s'" % + force_unicode(name)) + + self.custom_properties.append((name, value, property_type)) + def set_calc_mode(self, mode, calc_id=None): """ Set the Excel calculation mode for the workbook. @@ -1060,6 +1130,12 @@ if not image_data: fh.close() + # Set a default dpi for images with 0 dpi. + if x_dpi == 0: + x_dpi = 96 + if y_dpi == 0: + y_dpi = 96 + return image_type, width, height, image_name, x_dpi, y_dpi def _process_png(self, data): diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/XlsxWriter-0.8.7/xlsxwriter/worksheet.py new/XlsxWriter-0.9.3/xlsxwriter/worksheet.py --- old/XlsxWriter-0.8.7/xlsxwriter/worksheet.py 2016-04-27 21:48:54.000000000 +0200 +++ new/XlsxWriter-0.9.3/xlsxwriter/worksheet.py 2016-07-08 22:56:26.000000000 +0200 @@ -1766,7 +1766,7 @@ else: date_time = self._convert_date_time(options['value']) # Format date number to the same precision as Excel. - options['value'] = "%.15g" % date_time + options['value'] = "%.16g" % date_time if options['maximum']: if not supported_datetime(options['maximum']): @@ -1775,7 +1775,7 @@ return -2 else: date_time = self._convert_date_time(options['maximum']) - options['maximum'] = "%.15g" % date_time + options['maximum'] = "%.16g" % date_time # Check that the input title doesn't exceed the maximum length. if options.get('input_title') and len(options['input_title']) > 32: @@ -1973,7 +1973,7 @@ else: date_time = self._convert_date_time(options['value']) # Format date number to the same precision as Excel. - options['value'] = "%.15g" % date_time + options['value'] = "%.16g" % date_time if 'minimum' in options: if not supported_datetime(options['minimum']): @@ -1982,7 +1982,7 @@ return -2 else: date_time = self._convert_date_time(options['minimum']) - options['minimum'] = "%.15g" % date_time + options['minimum'] = "%.16g" % date_time if 'maximum' in options: if not supported_datetime(options['maximum']): @@ -1991,7 +1991,7 @@ return -2 else: date_time = self._convert_date_time(options['maximum']) - options['maximum'] = "%.15g" % date_time + options['maximum'] = "%.16g" % date_time # Swap last row/col for first row/col as necessary if first_row > last_row: @@ -2324,6 +2324,7 @@ # Add the table columns. col_id = 1 table['columns'] = [] + seen_names = {} for col_num in range(first_col, last_col + 1): # Set up the default column data. @@ -2338,10 +2339,11 @@ 'name_format': None, } - # Overwrite the defaults with any use defined values. + # Overwrite the defaults with any user defined values. if 'columns' in options: # Check if there are user defined values for this column. - user_data = options['columns'][col_id - 1] + if col_id <= len(options['columns']): + user_data = options['columns'][col_id - 1] if user_data: # Get the column format. @@ -2351,6 +2353,16 @@ if user_data.get('header'): col_data['name'] = user_data['header'] + # Excel requires unique case insensitive header names. + header_name = col_data['name'] + name = header_name.lower() + if name in seen_names: + warn("Duplicate header name in add_table(): '%s'" + % force_unicode(name)) + return -1 + else: + seen_names[name] = True + col_data['name_format'] = user_data.get('header_format') # Handle the column formula. @@ -4424,7 +4436,7 @@ if type(cell).__name__ == 'Number': # Return a number with Excel's precision. - data.append("%.15g" % cell.number) + data.append("%.16g" % cell.number) elif type(cell).__name__ == 'String': # Return a string from it's shared string index. @@ -4791,7 +4803,7 @@ attributes = [ ('min', col_min + 1), ('max', col_max + 1), - ('width', "%.15g" % width)] + ('width', "%.16g" % width)] if xf_index: attributes.append(('style', xf_index)) @@ -6177,10 +6189,10 @@ # Format splits to the same precision as Excel. if x_split: - attributes.append(('xSplit', "%.15g" % x_split)) + attributes.append(('xSplit', "%.16g" % x_split)) if y_split: - attributes.append(('ySplit', "%.15g" % y_split)) + attributes.append(('ySplit', "%.16g" % y_split)) attributes.append(('topLeftCell', top_left_cell)) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/XlsxWriter-0.8.7/xlsxwriter/xmlwriter.py new/XlsxWriter-0.9.3/xlsxwriter/xmlwriter.py --- old/XlsxWriter-0.8.7/xlsxwriter/xmlwriter.py 2016-04-20 00:32:29.000000000 +0200 +++ new/XlsxWriter-0.9.3/xlsxwriter/xmlwriter.py 2016-07-08 22:55:25.000000000 +0200 @@ -134,7 +134,7 @@ value = self._escape_attributes(value) attr += ' %s="%s"' % (key, value) - self.fh.write("""<c%s><v>%.15g</v></c>""" % (attr, number)) + self.fh.write("""<c%s><v>%.16g</v></c>""" % (attr, number)) def _xml_formula_element(self, formula, result, attributes=[]): # Optimized tag writer for <c> cell formula elements in the inner loop.
