Merge branch 'master' of https://github.com/chfw/pyexcel-xls
This commit is contained in:
commit
396caa5d6f
2
LICENSE
2
LICENSE
|
@ -1,4 +1,4 @@
|
|||
Copyright (c) 2015 by Onni Software Ltd.
|
||||
Copyright (c) 2015-2016 by Onni Software Ltd.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms of the software as well
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
include README.rst
|
||||
include requirements.txt
|
||||
include VERSION
|
|
@ -22,6 +22,7 @@ You can install it via pip:
|
|||
|
||||
.. code-block:: bash
|
||||
|
||||
$ pip install pyexcel-xls
|
||||
|
||||
or clone it and install it:
|
||||
|
||||
|
|
|
@ -15,6 +15,12 @@
|
|||
import sys
|
||||
import os
|
||||
|
||||
try:
|
||||
with open(os.path.join("..", "..", "VERSION"), "r") as version:
|
||||
version_txt = version.read().rstrip()
|
||||
except:
|
||||
version_txt = "not_in_sphinx"
|
||||
|
||||
# If extensions (or modules to document with autodoc) are in another directory,
|
||||
# add these directories to sys.path here. If the directory is relative to the
|
||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||
|
@ -28,7 +34,9 @@ import os
|
|||
# Add any Sphinx extension module names here, as strings. They can be
|
||||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
||||
# ones.
|
||||
extensions = []
|
||||
extensions = [
|
||||
'sphinx.ext.doctest'
|
||||
]
|
||||
|
||||
# Add any paths that contain templates here, relative to this directory.
|
||||
templates_path = ['_templates']
|
||||
|
@ -51,9 +59,9 @@ copyright = u'2015, C.W.'
|
|||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = '0.0.8'
|
||||
version = version_txt
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = '0.0.8'
|
||||
release = version_txt
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
The lower level xls/xlsm file format handler using xlrd/xlwt
|
||||
|
||||
:copyright: (c) 2015 by Onni Software Ltd
|
||||
:copyright: (c) 2015-2016 by Onni Software Ltd
|
||||
:license: New BSD License
|
||||
"""
|
||||
import sys
|
||||
|
@ -19,7 +19,7 @@ from pyexcel_io import (
|
|||
READERS,
|
||||
WRITERS,
|
||||
isstream,
|
||||
load_data as read_data,
|
||||
get_data as read_data,
|
||||
store_data as write_data
|
||||
)
|
||||
PY2 = sys.version_info[0] == 2
|
||||
|
@ -198,10 +198,20 @@ class XLWriter(BookWriter):
|
|||
"""
|
||||
xls, xlsx and xlsm writer
|
||||
"""
|
||||
def __init__(self, file, **keywords):
|
||||
"""Initialize a xlwt work book"""
|
||||
def __init__(self, file, encoding='ascii',
|
||||
style_compression=2, **keywords):
|
||||
"""Initialize a xlwt work book
|
||||
|
||||
|
||||
:param encoding: content encoding, defaults to 'ascii'
|
||||
:param style_compression: undocumented, but 2 is magically
|
||||
better
|
||||
reference: `style_compression <https://groups.google.com/
|
||||
forum/#!topic/python-excel/tUZkMRi8ITw>`_
|
||||
"""
|
||||
BookWriter.__init__(self, file, **keywords)
|
||||
self.wb = Workbook(style_compression=2)
|
||||
self.wb = Workbook(style_compression=style_compression,
|
||||
encoding=encoding)
|
||||
|
||||
def create_sheet(self, name):
|
||||
"""Create a xlwt writer"""
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
pyexcel-io==0.1.0-rc1
|
||||
xlrd
|
||||
xlwt-future
|
||||
|
|
11
setup.py
11
setup.py
|
@ -10,17 +10,21 @@ with open("README.rst", 'r') as readme:
|
|||
README_txt = readme.read()
|
||||
|
||||
dependencies = [
|
||||
'pyexcel-io==0.1.0-rc1',
|
||||
'xlrd',
|
||||
'xlwt-future',
|
||||
'pyexcel-io>=0.0.4'
|
||||
'xlwt-future'
|
||||
]
|
||||
|
||||
with open("VERSION", "r") as version:
|
||||
version_txt = version.read().rstrip()
|
||||
|
||||
if sys.version_info[0] == 2 and sys.version_info[1] < 7:
|
||||
dependencies.append('ordereddict')
|
||||
|
||||
setup(
|
||||
name='pyexcel-xls',
|
||||
author="C. W.",
|
||||
version='0.0.8',
|
||||
version=version_txt,
|
||||
author_email="wangc_2011@hotmail.com",
|
||||
url="https://github.com/chfw/pyexcel-xls",
|
||||
description='A wrapper library to read, manipulate and write data in xls format. It reads xlsx and xlsm format',
|
||||
|
@ -44,6 +48,7 @@ setup(
|
|||
'Programming Language :: Python :: 2.7',
|
||||
'Programming Language :: Python :: 3.3',
|
||||
'Programming Language :: Python :: 3.4',
|
||||
'Programming Language :: Python :: 3.5',
|
||||
'Programming Language :: Python :: Implementation :: PyPy'
|
||||
]
|
||||
)
|
||||
|
|
|
@ -28,4 +28,5 @@ class TestBugFix:
|
|||
for i in range(4100):
|
||||
array.append([datetime.datetime.now()])
|
||||
data.update({"test": array})
|
||||
s = xls.save_data("test.xls", data)
|
||||
s = xls.save_data("test.xls", data)
|
||||
os.unlink("test.xls")
|
||||
|
|
|
@ -16,6 +16,8 @@ class TestNativeXLWriter:
|
|||
writer.close()
|
||||
reader = xls.XLBook(self.testfile)
|
||||
content = reader.sheets()
|
||||
for key in content.keys():
|
||||
content[key] = list(content[key])
|
||||
assert content == self.content
|
||||
|
||||
def tearDown(self):
|
||||
|
|
Loading…
Reference in New Issue