Esempio n. 1
0
 def new(cls, pic_id, image_filename):
     nvPicPr = OxmlElement('pic:nvPicPr')
     nvPicPr.append(CT_NonVisualDrawingProps.new(
         'pic:cNvPr', pic_id, image_filename
     ))
     nvPicPr.append(CT_NonVisualPictureProperties.new())
     return nvPicPr
Esempio n. 2
0
 def add_drawing(self, inline_or_anchor):
     """
     Return a newly appended ``CT_Drawing`` (``<w:drawing>``) child
     element having *inline_or_anchor* as its child.
     """
     drawing = OxmlElement('w:drawing')
     self.append(drawing)
     drawing.append(inline_or_anchor)
     return drawing
Esempio n. 3
0
 def new(cls):
     """
     Return a new ``<w:tc>`` element, containing an empty paragraph as the
     required EG_BlockLevelElt.
     """
     tc = OxmlElement('w:tc')
     p = CT_P.new()
     tc.append(p)
     return tc
Esempio n. 4
0
 def new(cls):
     """
     Return a new ``<w:tc>`` element, containing an empty paragraph as the
     required EG_BlockLevelElt.
     """
     tc = OxmlElement('w:tc')
     p = CT_P.new()
     tc.append(p)
     return tc
Esempio n. 5
0
 def add_drawing(self, inline_or_anchor):
     """
     Return a newly appended ``CT_Drawing`` (``<w:drawing>``) child
     element having *inline_or_anchor* as its child.
     """
     drawing = OxmlElement('w:drawing')
     self.append(drawing)
     drawing.append(inline_or_anchor)
     return drawing
Esempio n. 6
0
 def new(cls, num_id, abstractNum_id):
     """
     Return a new ``<w:num>`` element having numId of *num_id* and having
     a ``<w:abstractNumId>`` child with val attribute set to
     *abstractNum_id*.
     """
     abstractNumId = CT_DecimalNumber.new('w:abstractNumId', abstractNum_id)
     num = OxmlElement('w:num', {qn('w:numId'): str(num_id)})
     num.append(abstractNumId)
     return num
Esempio n. 7
0
 def new(cls):
     """
     Return a new ``<w:tbl>`` element, containing the required
     ``<w:tblPr>`` and ``<w:tblGrid>`` child elements.
     """
     tbl = OxmlElement('w:tbl')
     tblPr = CT_TblPr.new()
     tbl.append(tblPr)
     tblGrid = CT_TblGrid.new()
     tbl.append(tblGrid)
     return tbl
Esempio n. 8
0
 def new(cls, pic_id, filename, rId, cx, cy):
     """
     Return a new ``<pic:pic>`` element populated with the minimal
     contents required to define a viable picture element, based on the
     values passed as parameters.
     """
     pic = OxmlElement('pic:pic', nsmap=nspfxmap('pic', 'r'))
     pic.append(CT_PictureNonVisual.new(pic_id, filename))
     pic.append(CT_BlipFillProperties.new(rId))
     pic.append(CT_ShapeProperties.new(cx, cy))
     return pic
Esempio n. 9
0
 def new(cls, pic_id, filename, rId, cx, cy):
     """
     Return a new ``<pic:pic>`` element populated with the minimal
     contents required to define a viable picture element, based on the
     values passed as parameters.
     """
     pic = OxmlElement('pic:pic', nsmap=nspfxmap('pic', 'r'))
     pic.append(CT_PictureNonVisual.new(pic_id, filename))
     pic.append(CT_BlipFillProperties.new(rId))
     pic.append(CT_ShapeProperties.new(cx, cy))
     return pic
Esempio n. 10
0
 def new(cls):
     """
     Return a new ``<w:tbl>`` element, containing the required
     ``<w:tblPr>`` and ``<w:tblGrid>`` child elements.
     """
     tbl = OxmlElement('w:tbl')
     tblPr = CT_TblPr.new()
     tbl.append(tblPr)
     tblGrid = CT_TblGrid.new()
     tbl.append(tblGrid)
     return tbl
Esempio n. 11
0
 def new(cls, num_id, abstractNum_id):
     """
     Return a new ``<w:num>`` element having numId of *num_id* and having
     a ``<w:abstractNumId>`` child with val attribute set to
     *abstractNum_id*.
     """
     abstractNumId = CT_DecimalNumber.new(
         'w:abstractNumId', abstractNum_id
     )
     num = OxmlElement('w:num', {qn('w:numId'): str(num_id)})
     num.append(abstractNumId)
     return num
Esempio n. 12
0
    def new(cls, cx, cy, shape_id, pic):
        """
        Return a new ``<wp:inline>`` element populated with the values passed
        as parameters.
        """
        name = 'Picture %d' % shape_id
        uri = nsmap['pic']

        inline = OxmlElement('wp:inline', nsmap=nspfxmap('wp', 'r'))
        inline.append(CT_PositiveSize2D.new('wp:extent', cx, cy))
        inline.append(CT_NonVisualDrawingProps.new('wp:docPr', shape_id, name))
        inline.append(CT_GraphicalObject.new(uri, pic))
        return inline
Esempio n. 13
0
    def new(cls, cx, cy, shape_id, pic):
        """
        Return a new ``<wp:inline>`` element populated with the values passed
        as parameters.
        """
        name = 'Picture %d' % shape_id
        uri = nsmap['pic']

        inline = OxmlElement('wp:inline', nsmap=nspfxmap('wp', 'r'))
        inline.append(CT_PositiveSize2D.new('wp:extent', cx, cy))
        inline.append(CT_NonVisualDrawingProps.new(
            'wp:docPr', shape_id, name
        ))
        inline.append(CT_GraphicalObject.new(uri, pic))
        return inline
Esempio n. 14
0
 def new(cls, rId):
     blipFill = OxmlElement('pic:blipFill')
     blipFill.append(CT_Blip.new(rId))
     blipFill.append(CT_StretchInfoProperties.new())
     return blipFill
Esempio n. 15
0
 def new(cls, cx, cy):
     spPr = OxmlElement('a:xfrm')
     spPr.append(CT_Point2D.new('a:off', 0, 0))
     spPr.append(CT_PositiveSize2D.new('a:ext', cx, cy))
     return spPr
Esempio n. 16
0
 def new(cls):
     stretch = OxmlElement('a:stretch')
     stretch.append(CT_RelativeRect.new())
     return stretch
Esempio n. 17
0
 def new(cls, cx, cy):
     spPr = OxmlElement('pic:spPr')
     spPr.append(CT_Transform2D.new(cx, cy))
     spPr.append(CT_PresetGeometry2D.new('rect'))
     return spPr
Esempio n. 18
0
 def new(cls, uri, pic):
     graphic = OxmlElement('a:graphic')
     graphic.append(CT_GraphicalObjectData.new(uri, pic))
     return graphic
Esempio n. 19
0
 def new(cls, cx, cy):
     spPr = OxmlElement('pic:spPr')
     spPr.append(CT_Transform2D.new(cx, cy))
     spPr.append(CT_PresetGeometry2D.new('rect'))
     return spPr
Esempio n. 20
0
 def new(cls, cx, cy):
     spPr = OxmlElement('a:xfrm')
     spPr.append(CT_Point2D.new('a:off', 0, 0))
     spPr.append(CT_PositiveSize2D.new('a:ext', cx, cy))
     return spPr
Esempio n. 21
0
 def new(cls, uri, pic):
     graphicData = OxmlElement('a:graphicData')
     graphicData.set('uri', uri)
     graphicData.append(pic)
     return graphicData
Esempio n. 22
0
 def new(cls, uri, pic):
     graphic = OxmlElement('a:graphic')
     graphic.append(CT_GraphicalObjectData.new(uri, pic))
     return graphic
Esempio n. 23
0
 def new(cls, uri, pic):
     graphicData = OxmlElement('a:graphicData')
     graphicData.set('uri', uri)
     graphicData.append(pic)
     return graphicData
Esempio n. 24
0
 def new(cls):
     stretch = OxmlElement('a:stretch')
     stretch.append(CT_RelativeRect.new())
     return stretch
Esempio n. 25
0
 def new(cls, pic_id, image_filename):
     nvPicPr = OxmlElement('pic:nvPicPr')
     nvPicPr.append(
         CT_NonVisualDrawingProps.new('pic:cNvPr', pic_id, image_filename))
     nvPicPr.append(CT_NonVisualPictureProperties.new())
     return nvPicPr
Esempio n. 26
0
 def new(cls, rId):
     blipFill = OxmlElement('pic:blipFill')
     blipFill.append(CT_Blip.new(rId))
     blipFill.append(CT_StretchInfoProperties.new())
     return blipFill