微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Python xlrd 模块-oREL() 实例源码

Python xlrd 模块,oREL() 实例源码

我们从Python开源项目中,提取了以下9个代码示例,用于说明如何使用xlrd.oREL()

项目:meter    作者:qianqians    | 项目源码 | 文件源码
def show_name_object(book, nobj, show_contents=0, f=sys.stdout):
    print("\nName: %s,scope: %s (%s)" \
        % (REPR(nobj.name), REPR(nobj.scope), scope_as_string(book, nobj.scope)), file=f)
    res = nobj.result
    print("Formula eval result: %s" % REPR(res), file=f)
    if res is None:
        return
    # result should be an instance of the Operand class
    kind = res.kind
    value = res.value
    if kind >= 0:
        # A scalar,or unknown ... you've seen all there is to see.
        pass
    elif kind == xlrd.oREL:
        # A list of Ref3D objects representing *relative* ranges
        for i in range(len(value)):
            ref3d = value[i]
            print("Range %d: %s ==> %s"% (i, REPR(ref3d.coords), REPR(xlrd.rangename3drel(book, ref3d))), file=f)
    elif kind == xlrd.oREF:
        # A list of Ref3D objects
        for i in range(len(value)):
            ref3d = value[i]
            print("Range %d: %s ==> %s"% (i, REPR(xlrd.rangename3d(book, file=f)
            if not show_contents:
                continue
            datemode = book.datemode
            for shx in range(ref3d.shtxlo, ref3d.shtxhi):
                sh = book.sheet_by_index(shx)
                print("   Sheet #%d (%s)" % (shx, sh.name), file=f)
                rowlim = min(ref3d.rowxhi, sh.nrows)
                collim = min(ref3d.colxhi, sh.ncols)
                for rowx in range(ref3d.rowxlo, rowlim):
                    for colx in range(ref3d.colxlo, collim):
                        cty = sh.cell_type(rowx, colx)
                        if cty == xlrd.XL_CELL_EMPTY and show_contents == 1:
                            continue
                        cval = sh.cell_value(rowx, colx)
                        sval = showable_cell_value(cty, cval, datemode)
                        print("      (%3d,%3d) %-5s: %s"
                            % (rowx, colx, xlrd.cellname(rowx, colx), REPR(sval)), file=f)
项目:OneClickDTU    作者:satwikkansal    | 项目源码 | 文件源码
def show_name_object(book, file=f)
项目:fusion360-dxf-export    作者:opendesk    | 项目源码 | 文件源码
def show_name_object(book, file=f)
项目:InternationalizationScript-iOS    作者:alexfeng    | 项目源码 | 文件源码
def show_name_object(book, file=f)
项目:InternationalizationScript-iOS    作者:alexfeng    | 项目源码 | 文件源码
def show_name_object(book, file=f)
项目:xls2lua-tools    作者:pepsigit    | 项目源码 | 文件源码
def show_name_object(book, file=f)
项目:smartschool    作者:asifkodur    | 项目源码 | 文件源码
def show_name_object(book, f=sys.stdout):
    print >> f, "\nName: %r,scope: %r (%s)" \
        % (nobj.name, nobj.scope, nobj.scope))
    res = nobj.result
    print >> f, "Formula eval result: %r" % res
    if res is None:
        return
    # result should be an instance of the Operand class
    kind = res.kind
    value = res.value
    if kind >= 0:
        # A scalar,or unknown ... you've seen all there is to see.
        pass
    elif kind == xlrd.oREL:
        # A list of Ref3D objects representing *relative* ranges
        for i in xrange(len(value)):
            ref3d = value[i]
            print >> f, "Range %d: %r ==> %s"% (i, ref3d.coords, xlrd.rangename3drel(book, ref3d))
    elif kind == xlrd.oREF:
        # A list of Ref3D objects
        for i in xrange(len(value)):
            ref3d = value[i]
            print >> f, xlrd.rangename3d(book, ref3d))
            if not show_contents:
                continue
            datemode = book.datemode
            for shx in xrange(ref3d.shtxlo, ref3d.shtxhi):
                sh = book.sheet_by_index(shx)
                print >> f, "   Sheet #%d (%s)" % (shx, sh.name)
                rowlim = min(ref3d.rowxhi, sh.ncols)
                for rowx in xrange(ref3d.rowxlo, rowlim):
                    for colx in xrange(ref3d.colxlo, datemode)
                        print >> f, "      (%3d,%3d) %-5s: %r" \
                            % (rowx, sval)
项目:xls2lua    作者:jiangzhhhh    | 项目源码 | 文件源码
def show_name_object(book, file=f)
项目:mes    作者:osess    | 项目源码 | 文件源码
def show_name_object(book, file=f)

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐