Exemplo n.º 1
0
from __future__ import absolute_import
# Copyright (c) 2010-2016 openpyxl

from openpyxl import __version__

VERSION = ".".join(__version__.split(".")[:2])

from openpyxl.compat import unicode

from openpyxl.descriptors.serialisable import Serialisable
from openpyxl.descriptors import (
    Typed, )
from openpyxl.descriptors.nested import (
    NestedText, )

from openpyxl.xml.constants import XPROPS_NS


class DigSigBlob(Serialisable):

    __elements__ = __attrs__ = ()


class VectorLpstr(Serialisable):

    __elements__ = __attrs__ = ()


class VectorVariant(Serialisable):

    __elements__ = __attrs__ = ()
Exemplo n.º 2
0
    def _get_value(self, cls, req, **kwargs):
        return kwargs.get('mimetype')


class filename_ext(ExpectedValuePredicate):
    """ a selector for converters  """
    def _get_value(self, cls, req, **kwargs):
        fname = kwargs.get('filename')
        if fname:
            return osp.splitext(fname)[1]
        return fname


if utils.HANDLE_XLSX:
    from openpyxl import __version__
    _old_openpyxl_version = __version__.split('.') < (1, 9, 0)

    def rows(sheet):
        if _old_openpyxl_version:
            return sheet.iter_rows()
        else:
            return sheet.rows

    def value(cell):
        if _old_openpyxl_version:
            return cell.internal_value
        else:
            return cell.value


# importers ####################################################################
Exemplo n.º 3
0
def get_version():
    from openpyxl import __version__

    VERSION = ".".join(__version__.split(".")[:2])
    return VERSION
Exemplo n.º 4
0
def get_version():
    from openpyxl import __version__

    VERSION = ".".join(__version__.split(".")[:2])
    return VERSION
Exemplo n.º 5
0
from __future__ import absolute_import
# Copyright (c) 2010-2016 openpyxl

from openpyxl import __version__

VERSION = ".".join(__version__.split(".")[:2])

from openpyxl.compat import basestring

from openpyxl.descriptors.serialisable import Serialisable
from openpyxl.descriptors import (
    Typed,
)
from openpyxl.descriptors.nested import (
    NestedText,
)

from openpyxl.xml.constants import XPROPS_NS


class DigSigBlob(Serialisable):

    __elements__ = __attrs__ = ()


class VectorLpstr(Serialisable):

    __elements__ = __attrs__ = ()


class VectorVariant(Serialisable):
Exemplo n.º 6
0
# coding: utf-8

from collections import OrderedDict

from openpyxl import load_workbook, Workbook
from openpyxl import __version__

openpyxl_version = int(__version__.split(".")[0])


class UnicodeReader(object):

    def __init__(self, filename, sheet_name_or_num=0):
        """
        Iterate quickly row-by-row through an Excel file.

        If you want to access a specific row, simply read the whole file with:

        rows = [row for row in UnicodeReader('myfile.xls')]

        ... and then access the intended row in the usual fashion.
        """
        self.__wb = load_workbook(filename=filename, read_only=True)
        self._sheet = None
        self.change_sheet(sheet_name_or_num)

    def change_sheet(self, sheet_name_or_num):
        """
        Calling this method changes the sheet in anticipation for the
        next time you create an iterator.