当前位置: 首页>>代码示例>>Python>>正文


Python TableCell.setAttrNS方法代码示例

本文整理汇总了Python中odf.table.TableCell.setAttrNS方法的典型用法代码示例。如果您正苦于以下问题:Python TableCell.setAttrNS方法的具体用法?Python TableCell.setAttrNS怎么用?Python TableCell.setAttrNS使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在odf.table.TableCell的用法示例。


在下文中一共展示了TableCell.setAttrNS方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: add_title

# 需要导入模块: from odf.table import TableCell [as 别名]
# 或者: from odf.table.TableCell import setAttrNS [as 别名]
 def add_title(self, title, width):
     row = TableRow()
     cell = TableCell(stylename="title")
     cell.setAttrNS(TABLENS, "number-columns-spanned", width)
     cell.addElement(P(text=title))
     row.addElement(cell)
     self.sheet.addElement(row)
开发者ID:CroissanceCommune,项目名称:autonomie,代码行数:9,代码来源:ods.py

示例2: write_cell

# 需要导入模块: from odf.table import TableCell [as 别名]
# 或者: from odf.table.TableCell import setAttrNS [as 别名]
 def write_cell(self, row, x):
     tc = TableCell()
     x_type = type(x)
     x_odf_type = ODS_WRITE_FORMAT_COVERSION.get(x_type, "string")
     tc.setAttrNS(OFFICENS, "value-type", x_odf_type)
     x_odf_value_token = VALUE_TOKEN.get(x_odf_type, "value")
     converter = ODS_VALUE_CONVERTERS.get(x_odf_type, None)
     if converter:
         x = converter(x)
     if x_odf_type != 'string':
         tc.setAttrNS(OFFICENS, x_odf_value_token, x)
     tc.addElement(P(text=x))
     row.addElement(tc)
开发者ID:fuhrysteve,项目名称:pyexcel-ods,代码行数:15,代码来源:__init__.py

示例3: write_cell

# 需要导入模块: from odf.table import TableCell [as 别名]
# 或者: from odf.table.TableCell import setAttrNS [as 别名]
 def write_cell(self, row, cell):
     tc = TableCell()
     cell_type = type(cell)
     cell_odf_type = ODS_WRITE_FORMAT_COVERSION.get(cell_type, "string")
     tc.setAttrNS(OFFICENS, "value-type", cell_odf_type)
     cell_odf_value_token = VALUE_TOKEN.get(cell_odf_type, "value")
     converter = ODS_VALUE_CONVERTERS.get(cell_odf_type, None)
     if converter:
         cell = converter(cell)
     if cell_odf_type != 'string':
         tc.setAttrNS(OFFICENS, cell_odf_value_token, cell)
         tc.addElement(P(text=cell))
     else:
         lines = cell.split('\n')
         for line in lines:
             tc.addElement(P(text=line))
     row.addElement(tc)
开发者ID:targueriano,项目名称:neuroIFC,代码行数:19,代码来源:__init__.py

示例4: write_cell

# 需要导入模块: from odf.table import TableCell [as 别名]
# 或者: from odf.table.TableCell import setAttrNS [as 别名]
 def write_cell(self, row, cell):
     """write a native cell"""
     cell_to_be_written = TableCell()
     cell_type = type(cell)
     cell_odf_type = converter.ODS_WRITE_FORMAT_COVERSION.get(
         cell_type, "string")
     cell_to_be_written.setAttrNS(OFFICENS, "value-type", cell_odf_type)
     cell_odf_value_token = converter.VALUE_TOKEN.get(
         cell_odf_type, "value")
     converter_func = converter.ODS_VALUE_CONVERTERS.get(
         cell_odf_type, None)
     if converter_func:
         cell = converter_func(cell)
     if cell_odf_type != 'string':
         cell_to_be_written.setAttrNS(OFFICENS, cell_odf_value_token, cell)
         cell_to_be_written.addElement(P(text=cell))
     else:
         lines = cell.split('\n')
         for line in lines:
             cell_to_be_written.addElement(P(text=line))
     row.addElement(cell_to_be_written)
开发者ID:schulzsebastian,项目名称:qgisplugin_spreadsheet,代码行数:23,代码来源:ods.py

示例5: _get_cell

# 需要导入模块: from odf.table import TableCell [as 别名]
# 或者: from odf.table.TableCell import setAttrNS [as 别名]
    def _get_cell(self, label, stylename=None):
        """
        Build a TableCell and adapt the format to the provided label format

        :param label: The data to write (int/float/bool/date/str/unicode)
        :param str stylename: One of the stylenames added in the __init__
        :returns: A TableCell instance
        """
        if stylename is not None:
            cell_to_be_written = TableCell(stylename=stylename)
        else:
            cell_to_be_written = TableCell()
        cell_type = type(label)
        cell_odf_type = converter.ODS_WRITE_FORMAT_COVERSION.get(
            cell_type,
            "string"
        )
        cell_to_be_written.setAttrNS(OFFICENS, "value-type", cell_odf_type)
        cell_odf_value_token = converter.VALUE_TOKEN.get(
            cell_odf_type,
            "value",
        )
        converter_func = converter.ODS_VALUE_CONVERTERS.get(
            cell_odf_type,
            None
        )
        if converter_func:
            label = converter_func(label)
        if cell_odf_type != 'string':
            cell_to_be_written.setAttrNS(OFFICENS, cell_odf_value_token, label)
            cell_to_be_written.addElement(P(text=label))
        else:
            lines = label.split('\n')
            for line in lines:
                cell_to_be_written.addElement(P(text=line))
        return cell_to_be_written
开发者ID:CroissanceCommune,项目名称:autonomie,代码行数:38,代码来源:ods.py


注:本文中的odf.table.TableCell.setAttrNS方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。