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


Python functions.fromstring函数代码示例

本文整理汇总了Python中openpyxl.xml.functions.fromstring函数的典型用法代码示例。如果您正苦于以下问题:Python fromstring函数的具体用法?Python fromstring怎么用?Python fromstring使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: test_from_xml

 def test_from_xml(self, NonVisualDrawingProps):
     src = """
      <cNvPr id="3" name="Chart 2"></cNvPr>
     """
     node = fromstring(src)
     graphic = NonVisualDrawingProps.from_tree(node)
     assert graphic == NonVisualDrawingProps(id=3, name="Chart 2")
开发者ID:BespokeInsights,项目名称:openpyxl,代码行数:7,代码来源:test_graphic.py

示例2: read_content_types

def read_content_types(archive):
    """Read content types."""
    xml_source = archive.read(ARC_CONTENT_TYPES)
    root = fromstring(xml_source)
    contents_root = root.findall('{%s}Override' % CONTYPES_NS)
    for type in contents_root:
        yield type.get('ContentType'), type.get('PartName')
开发者ID:BlueMoon3000,项目名称:election-2016,代码行数:7,代码来源:workbook.py

示例3: test_from_xml

 def test_from_xml(self, FunctionGroup):
     src = """
     <functionGroup name="Database" />
     """
     node = fromstring(src)
     function_group = FunctionGroup.from_tree(node)
     assert function_group == FunctionGroup(name="Database")
开发者ID:BespokeInsights,项目名称:openpyxl,代码行数:7,代码来源:test_function_group.py

示例4: parse

    def parse(self):
        src = self.archive.read(self.workbook_part_name)
        node = fromstring(src)
        package = WorkbookPackage.from_tree(node)
        if package.properties.date1904:
            self.wb.excel_base_date = CALENDAR_MAC_1904

        self.wb.code_name = package.properties.codeName
        self.wb.active = package.active
        self.wb.views = package.bookViews
        self.sheets = package.sheets
        self.wb.calculation = package.calcPr
        self.caches = package.pivotCaches

        #external links contain cached worksheets and can be very big
        if not self.wb.keep_links:
            package.externalReferences = []

        for ext_ref in package.externalReferences:
            rel = self.rels[ext_ref.id]
            self.wb._external_links.append(
                read_external_link(self.archive, rel.Target)
            )

        if package.definedNames:
            package.definedNames._cleanup()
            self.wb.defined_names = package.definedNames

        self.wb.security = package.workbookProtection
开发者ID:JLL-Benson,项目名称:CHN_DQ,代码行数:29,代码来源:workbook.py

示例5: test_read_row

def test_read_row(datadir, DummyWorkbook, ReadOnlyWorksheet):
    datadir.join("reader").chdir()

    src = b"""
    <sheetData  xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" >
    <row r="1" spans="4:27">
      <c r="D1">
        <v>1</v>
      </c>
      <c r="K1">
        <v>0.01</v>
      </c>
      <c r="AA1">
        <v>100</v>
      </c>
    </row>
    </sheetData>
    """

    ws = ReadOnlyWorksheet(DummyWorkbook, "Sheet", "", "bug393-worksheet.xml", [])

    xml = fromstring(src)
    row = tuple(ws._get_row(xml, 11, 11))
    values = [c.value for c in row]
    assert values == [0.01]

    row = tuple(ws._get_row(xml, 1, 11))
    values = [c.value for c in row]
    assert values == [None, None, None, 1, None, None, None, None, None, None, 0.01]
开发者ID:schulzsebastian,项目名称:qgisplugin_xlsxcoordinates,代码行数:29,代码来源:test_iter.py

示例6: test_from_xml

 def test_from_xml(self, SmartTagProperties):
     src = """
     <smartTagPr />
     """
     node = fromstring(src)
     smart_tags = SmartTagProperties.from_tree(node)
     assert smart_tags == SmartTagProperties()
开发者ID:BespokeInsights,项目名称:openpyxl,代码行数:7,代码来源:test_smart_tags.py

示例7: test_read

 def test_read(self, ChartsheetView):
     src = """
     <sheetView tabSelected="1" zoomScale="80" workbookViewId="0" zoomToFit="1"/>
     """
     xml = fromstring(src)
     chart = ChartsheetView.from_tree(xml)
     assert chart.tabSelected == True
开发者ID:BespokeInsights,项目名称:openpyxl,代码行数:7,代码来源:test_views.py

示例8: test_from_xml

 def test_from_xml(self, WebPublishObjectList):
     src = """
     <webPublishingObjects />
     """
     node = fromstring(src)
     objs = WebPublishObjectList.from_tree(node)
     assert objs == WebPublishObjectList()
开发者ID:BespokeInsights,项目名称:openpyxl,代码行数:7,代码来源:test_web.py

示例9: test_from_xml

 def test_from_xml(self, SurfaceChart3D):
     src = """
     <surface3DChart>
     <wireframe val="0"/>
     <ser>
       <idx val="0"/>
       <order val="0"/>
       <val>
         <numRef>
           <f>Blatt1!$A$1:$A$12</f>
         </numRef>
       </val>
     </ser>
     <ser>
       <idx val="1"/>
       <order val="1"/>
       <val>
         <numRef>
           <f>Blatt1!$B$1:$B$12</f>
         </numRef>
       </val>
     </ser>
     <bandFmts/>
     <axId val="2082935272"/>
     <axId val="2082938248"/>
     <axId val="2082941288"/>
     </surface3DChart>
     """
     node = fromstring(src)
     chart = SurfaceChart3D.from_tree(node)
     assert len(chart.ser) == 2
     assert [a.val for a in chart.axId] == [10, 100, 1000]
开发者ID:BespokeInsights,项目名称:openpyxl,代码行数:32,代码来源:test_surface_chart.py

示例10: test_from_xml

 def test_from_xml(self, DefinedNameList):
     src = """
     <definedNames />
     """
     node = fromstring(src)
     names = DefinedNameList.from_tree(node)
     assert names == DefinedNameList()
开发者ID:BespokeInsights,项目名称:openpyxl,代码行数:7,代码来源:test_defined_name.py

示例11: from_xml

 def from_xml(self, TextAxis):
     src = """
     <catAx>
         <axId val="2065276984"/>
         <scaling>
           <orientation val="minMax"/>
         </scaling>
         <delete val="0"/>
         <axPos val="b"/>
         <majorTickMark val="out"/>
         <minorTickMark val="none"/>
         <tickLblPos val="nextTo"/>
         <crossAx val="2056619928"/>
         <crosses val="autoZero"/>
         <auto val="1"/>
         <lblAlgn val="ctr"/>
         <lblOffset val="100"/>
         <noMultiLvlLbl val="0"/>
     </catAx>
     """
     node = fromstring(src)
     axis = CatAx.from_tree(node)
     assert axis.scaling.orientation == "minMax"
     assert axis.auto is True
     assert axis.majorTickMark == "out"
     assert axis.minorTickMark is None
开发者ID:BespokeInsights,项目名称:openpyxl,代码行数:26,代码来源:test_axis.py

示例12: test_from_xml

 def test_from_xml(self, WorkbookProtection):
     src = """
     <workbookPr />
     """
     node = fromstring(src)
     prot = WorkbookProtection.from_tree(node)
     assert prot == WorkbookProtection()
开发者ID:BespokeInsights,项目名称:openpyxl,代码行数:7,代码来源:test_protection.py

示例13: test_from_xml

 def test_from_xml(self, Title):
     src = """
     <title />
     """
     node = fromstring(src)
     title = Title.from_tree(node)
     assert title == Title()
开发者ID:BespokeInsights,项目名称:openpyxl,代码行数:7,代码来源:test_title.py

示例14: test_from_xml

 def test_from_xml(self, GradientFillProperties):
     src = """
     <gradFill></gradFill>
     """
     node = fromstring(src)
     fill = GradientFillProperties.from_tree(node)
     assert fill == GradientFillProperties()
开发者ID:BespokeInsights,项目名称:openpyxl,代码行数:7,代码来源:test_shapes.py

示例15: test_from_tree

    def test_from_tree(self):
        from ..series import Series, attribute_mapping

        src = """
        <ser>
          <idx val="0"/>
          <order val="0"/>
          <spPr>
              <a:ln xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">
                <a:prstDash val="solid" />
              </a:ln>
            </spPr>
          <val>
            <numRef>
              <f>Blatt1!$A$1:$A$12</f>
            </numRef>
          </val>
        </ser>
        """
        node = fromstring(src)
        ser = Series.from_tree(node)
        assert ser.idx == 0
        assert ser.order == 0
        assert ser.val.numRef.ref == 'Blatt1!$A$1:$A$12'

        ser.__elements__ = attribute_mapping['area']
        xml = tostring(ser.to_tree())
        diff = compare_xml(xml, src)
        assert diff is None, diff
开发者ID:BespokeInsights,项目名称:openpyxl,代码行数:29,代码来源:test_series.py


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