Git Product home page Git Product logo

python-pptx's Introduction

python-pptx is a Python library for creating, reading, and updating PowerPoint (.pptx) files.

A typical use would be generating a PowerPoint presentation from dynamic content such as a database query, analytics output, or a JSON payload, perhaps in response to an HTTP request and downloading the generated PPTX file in response. It runs on any Python capable platform, including macOS and Linux, and does not require the PowerPoint application to be installed or licensed.

It can also be used to analyze PowerPoint files from a corpus, perhaps to extract search indexing text and images.

In can also be used to simply automate the production of a slide or two that would be tedious to get right by hand, which is how this all got started.

More information is available in the python-pptx documentation.

Browse examples with screenshots to get a quick idea what you can do with python-pptx.

python-pptx's People

Contributors

alexeybaj avatar gthb avatar hoopes avatar jaleskovec avatar karthik1024 avatar kevingu1003 avatar scanny avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

python-pptx's Issues

feature: slide/master background fill

Request: add ability to a) examine and b) change some elements of a theme -- notably the background color.

My method for doing this in Powerpoint 2013 on Windows is to:
View...Slide Master
Slide Master....Background...Colors to pick a presentation-wide theme
Slide Master....Background Styles to shift entire deck to dark or light backgrounds

KeyError: "no content type 'application/vnd.ms-excel' in pptx.spec.pml_parttypes"

I used a template containg a XLSX worksheet and get following error.
Is this something that is supported ?

ENVIRONMENT
OSX Mavericks
Office 2011

Traceback (most recent call last):

File "nhgdoc_dashboard.py", line 43, in <module>
    prs = Presentation(ppt_template)
  File "/Library/Python/2.7/site-packages/python_pptx-0.2.6-py2.7.egg/pptx/api.py", line 29, in __init__
    self.__package = _Package(file)
  File "/Library/Python/2.7/site-packages/python_pptx-0.2.6-py2.7.egg/pptx/presentation.py", line 93, in __init__
    self.__open(file)
  File "/Library/Python/2.7/site-packages/python_pptx-0.2.6-py2.7.egg/pptx/presentation.py", line 186, in __open
    pkg = pptx.packaging.Package().open(file)
  File "/Library/Python/2.7/site-packages/python_pptx-0.2.6-py2.7.egg/pptx/packaging.py", line 100, in open
    part._load(fs, partname, cti, parts_dict)
  File "/Library/Python/2.7/site-packages/python_pptx-0.2.6-py2.7.egg/pptx/packaging.py", line 256, in _load
    target_part._load(fs, target_partname, ct_dict, parts_dict)
  File "/Library/Python/2.7/site-packages/python_pptx-0.2.6-py2.7.egg/pptx/packaging.py", line 256, in _load
    target_part._load(fs, target_partname, ct_dict, parts_dict)
  File "/Library/Python/2.7/site-packages/python_pptx-0.2.6-py2.7.egg/pptx/packaging.py", line 240, in _load
    self.typespec = PartTypeSpec(content_type)
  File "/Library/Python/2.7/site-packages/python_pptx-0.2.6-py2.7.egg/pptx/packaging.py", line 517, in __init__
    raise KeyError(tmpl % content_type)
KeyError: "no content type 'application/vnd.ms-excel' in pptx.spec.pml_parttypes"

Charts/Graphs

I didn't see anything in the documentation for adding charts and graphs into the powerpoint. Do you know if this is going to be added?

How to set properties for a textframe

Sorry to bother you with such a basic question. My programming skills are a bit rusty. :)

I have following code :

# Add textframe         
            left = Inches(1.0)
            top = Inches(4.0)
            width = Inches(6.0)
            height = Inches(6.0)

            txBox = slide.shapes.add_textbox(left, top, width, height)
            tf = txBox.textframe

            tf.text = data['Progress']

How can I make the textframe to autowrap the text and give the textframe a black border ?

KeyError: "no content type 'application/x-fontdata' in pptx.spec.pml_parttypes"

I get the above error when opening a presentation. I'm guessing there's an embedded font that python-pptx can't cope with?

Traceback (most recent call last):
File "ppt_helloworld.py", line 4, in
prs = Presentation('sharp_template.pptx')
File "/usr/local/lib/python2.6/dist-packages/pptx/api.py", line 29, in init
self.package = _Package(file)
File "/usr/local/lib/python2.6/dist-packages/pptx/presentation.py", line 93, in __init

self.open(file)
File "/usr/local/lib/python2.6/dist-packages/pptx/presentation.py", line 186, in __open
pkg = pptx.packaging.Package().open(file)
File "/usr/local/lib/python2.6/dist-packages/pptx/packaging.py", line 100, in open
part._load(fs, partname, cti, parts_dict)
File "/usr/local/lib/python2.6/dist-packages/pptx/packaging.py", line 256, in _load
target_part._load(fs, target_partname, ct_dict, parts_dict)
File "/usr/local/lib/python2.6/dist-packages/pptx/packaging.py", line 240, in _load
self.typespec = PartTypeSpec(content_type)
File "/usr/local/lib/python2.6/dist-packages/pptx/packaging.py", line 517, in __init

raise KeyError(tmpl % content_type)
KeyError: "no content type 'application/x-fontdata' in pptx.spec.pml_parttypes"

feature: shape can be clickable hyperlink

Feature request:

PowerPoint allows a hyperlink to be added to a shape such that clicking the shape executes the link action. Add Shape.hyperlink.address read/write property to allow adding a hyperlink to a shape.

Error trying out sample examples: AttributeError: 'module' object has no attribute 'SubElement'

Hi,

I was trying out the following code on Windows 7( office 2007, python 2.7) when I encounter the issue highlighted

from pptx import Presentation

prs = Presentation()
title_slidelayout = prs.slidelayouts[0]
slide = prs.slides.add_slide(title_slidelayout)
title = slide.shapes.title
subtitle = slide.shapes.placeholders[1]

title.text = "Hello, World!"
subtitle.text = "python-pptx was here!"

Error:
Traceback (most recent call last):
File "C:\Python27\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 323, in RunScript
debugger.run(codeObject, main.dict, start_stepping=0)
File "C:\Python27\Lib\site-packages\pythonwin\pywin\debugger__init__.py", line 60, in run
_GetCurrentDebugger().run(cmd, globals,locals, start_stepping)
File "C:\Python27\Lib\site-packages\pythonwin\pywin\debugger\debugger.py", line 655, in run
exec cmd in globals, locals
File "C:\Users\356039\Desktop\pythonuserfiles\pptx_try1.py", line 1, in
from pptx import Presentation
File "C:\Python27\lib\site-packages\pptx\presentation.py", line 984, in add_slide
slide = _Slide(slidelayout)
File "C:\Python27\lib\site-packages\pptx\presentation.py", line 1064, in init
self._element = self.__minimal_element
File "C:\Python27\lib\site-packages\pptx\presentation.py", line 1098, in __minimal_element
_SubElement(sld, 'p:cSld', _nsmap)
File "C:\Python27\lib\site-packages\pptx\oxml.py", line 53, in _SubElement
return objectify.SubElement(parent, qn(tag), nsmap=nsmap)
AttributeError: 'module' object has no attribute 'SubElement'

May I know what might be causing the error?

Thanks.

KeyError: "no content type 'image/x-wmf' in pptx.spec.pml_parttypes"

When I try to load a template I am getting this error.
KeyError: "no content type 'image/x-wmf' in pptx.spec.pml_parttypes"

I added the following snippet to the "pml_parttypes" dictioanary in the "pptx/spec.py" file and it seems to fix the problem. Not sure if its the right fix.

'image/x-wmf':
{ 'basename' : 'image'
, 'ext' : '.wmf'
, 'name' : 'Image Part'
, 'cardinality' : PTS_CARDINALITY_TUPLE
, 'required' : False
, 'baseURI' : '/ppt/media'
, 'has_rels' : PTS_HASRELS_NEVER
, 'rels_from' : ['handoutMaster', 'notesSlide', 'notesMaster', 'slide', 'slideLayout', 'slideMaster']
, 'reltype' : RT_IMAGE
}

docs: document paragraph alignment options like ALIGN_CENTER

Maybe for future updates to the documentation, you could include some added options in the example as shown in the attached Python file. Actions like aligning/anchoring cell text and dynamically updating table content based on a list are not very intuitive the first time, so it's useful to have that in an example.

On 26 August 2013 02:08, Steve Canny [email protected] wrote:

The paragraph alignment should work as of version 0.2.5.

It looks like I didn't put an example in the docs, I'll have to remedy that.

The way you set it is to assign a value to paragraph.alignment like so:

from pptx.constants import PP

tbl.cell(0, 0).textframe.paragraphs[0].alignment = PP.ALIGN_CENTER

The possible values in PP are these:

ALIGN_CENTER
ALIGN_DISTRIBUTE
ALIGN_JUSTIFY
ALIGN_JUSTIFY_LOW
ALIGN_LEFT
ALIGNMENT_MIXED
ALIGN_RIGHT
ALIGN_THAI_DISTRIBUTE

The alignment property is read/write, so you can also discover its current setting (which can be None, meaning it inherits the default) with the code you have below and then comparing your font_align value to the list above.

#!/usr/bin/env python
from pptx import Presentation
from pptx.util import Inches
from pptx.constants import MSO, PP

prs = Presentation()
title_only_slidelayout = prs.slidelayouts[5]
slide = prs.slides.add_slide(title_only_slidelayout)
shapes = slide.shapes

shapes.title.text = 'Adding a Dynamic Table'
left = top = Inches(2.0)
width = Inches(6.0)
height = Inches(0.8)
col_headings = ["","Foo","Bar"]
row_names = ["","Baz","Qux"]
nrows = len(row_names)
ncols = len(col_headings)

# Add table
tbl = shapes.add_table(nrows, ncols, left, top, width, height)

for i in range(nrows):
    tbl.cell(i, 0).text = row_names[i]
    tbl.cell(i, 0).vertical_anchor = MSO.ANCHOR_MIDDLE  # Anchor text to middle of cell
    tbl.cell(i, 0).textframe.paragraphs[0].alignment = PP.ALIGN_CENTER  # Center align text

for j in range(ncols):
    tbl.cell(0, j).text = col_headings[j]
    tbl.cell(0, j).vertical_anchor = MSO.ANCHOR_MIDDLE
    tbl.cell(0, j).textframe.paragraphs[0].alignment = PP.ALIGN_CENTER

# set column widths
tbl.columns[0].width = Inches(2.0)
tbl.columns[1].width = Inches(1.0)
tbl.columns[2].width = Inches(2.0)

prs.save('test.pptx')

Non-standard but schema-valid rId values raise exception on Presentation.open()

Jasper Reports, and perhaps other PresentationML generators, produce relationship id values, some of which do not follow the PowerPoint® client convention of 'rId%d'. In this particular case, the relationship ids included 'rIdSm' for the slide master. A ValueError was thrown in _Relationship._num when this value was encountered.

KeyError: "no content type 'application/xml' in pptx.spec.pml_parttypes"

Hi,

I am trying to use python-pptx to parse an existing Powerpoint presentation and get the following error:

KeyError: "no content type 'application/xml' in pptx.spec.pml_parttypes"

Full stack trace:

Traceback (most recent call last):
File "pptx-test.py", line 26, in
prs = Presentation(Proposal_Filename)
File "C:\Python27\lib\site-packages\pptx\api.py", line 29, in init
self.__package = _Package(file)
File "C:\Python27\lib\site-packages\pptx\presentation.py", line 87, in _init
_
self.__open(file)
File "C:\Python27\lib\site-packages\pptx\presentation.py", line 170, in __open

pkg = pptx.packaging.Package().open(file)

File "C:\Python27\lib\site-packages\pptx\packaging.py", line 100, in open
part._load(fs, partname, cti, parts_dict)
File "C:\Python27\lib\site-packages\pptx\packaging.py", line 256, in _load
target_part._load(fs, target_partname, ct_dict, parts_dict)
File "C:\Python27\lib\site-packages\pptx\packaging.py", line 240, in _load
self.typespec = PartTypeSpec(content_type)
File "C:\Python27\lib\site-packages\pptx\packaging.py", line 518, in init
raise KeyError(tmpl % content_type)
KeyError: "no content type 'application/xml' in pptx.spec.pml_parttypes"

Any help greatly appreciated.

Thanks

API to set paragraph indent level

In PresentationML, paragraphs have a level attribute, which determines the level of indentation at which they are displayed. This is perhaps most commonly observed in a bullet slide, where a bullet can have "child" bullets that are indented underneath them.

Support setting the paragraph level in the paragraph API.

Add_picture should accept StringIO instances

If I have a png image in a buffer (fetched from a network resource) I should be able to call directly to add_picture instead of writing it to disk and then sending a filepath to add_picture.

Won't install through pip

When I try to install python-pptx through pip (Python 2.7, updated pip, Ubuntu), I get

No distributions at all found for PIL (from python-pptx)

Is this a bug? Why can't the dependency be satisfied by the more pip friendly Pillow? PIL does not correctly install through pip. I believe this is a known issue: http://stackoverflow.com/questions/2485295/the-problem-with-installing-pil-using-virtualenv-or-buildout

I know there are work-arounds (e.g. just installing PIL without pip), but I was just wondering if you guys were aware/ had some additional insight. Keep of the good work, cheers :)

ZipFile error

I am getting an error on python2.6 on the following script that works fine in python2.7, is this something that is fixable?

I can mitigate it with the fix in https://github.com/vidar/python-pptx/commit/3c87a0fd311c4f22a428877719638409cf4edd97 but that is obviously not a long term approach.

from pptx import Presentation

if __name__ == '__main__':
    prs = Presentation()
    slidelayout = prs.slidemasters[0].slidelayouts[5]
    img_slide = prs.slides.add_slide(slidelayout)
    prs.save('test.pptx')

gives the following stacktrace:

(DM)vidar@berzerker:~$ python a.py 
Traceback (most recent call last):
  File "a.py", line 7, in <module>
    prs.save('test.pptx')
  File "/Users/vidar/.virtualenvs/DM/src/pptx/pptx/api.py", line 64, in save
    return self.__package.save(path)
  File "/Users/vidar/.virtualenvs/DM/src/pptx/pptx/presentation.py", line 125, in save
    pkgng_pkg.save(path)
  File "/Users/vidar/.virtualenvs/DM/src/pptx/pptx/packaging.py", line 134, in save
    zipfs.write_element(cti.element, '/[Content_Types].xml')
  File "/Users/vidar/.virtualenvs/DM/src/pptx/pptx/packaging.py", line 849, in write_element
    if itemURI in self:
  File "/Users/vidar/.virtualenvs/DM/src/pptx/pptx/packaging.py", line 687, in __contains__
    return itemURI in self.itemURIs
  File "/Users/vidar/.virtualenvs/DM/src/pptx/pptx/packaging.py", line 811, in itemURIs
    zip = zipfile.ZipFile(self.path)
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/zipfile.py", line 696, in __init__
    self._GetContents()
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/zipfile.py", line 716, in _GetContents
    self._RealGetContents()
  File "/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/zipfile.py", line 728, in _RealGetContents
    raise BadZipfile, "File is not a zip file"
zipfile.BadZipfile: File is not a zip file

Fails to create table larger than 6 rows

Hey scanny,

I'm on Windows, using Python 2.7.1

The module creates tables with <= 6 rows but fails to open in MS PowerPoint when the row count is >= 7.

I've extracted the pptx files and diffed them and it seems like the only real difference are the <a:tr h="..."> tags. The values are <a:tr h="91440"> for 6 rows and <a:tr h="121920"> for 8 rows which doesn't seem to be a big deal. However, as I said MS PowerPoint can't open it.

Here's some test code:

# imports
from pptx import Presentation
from pptx.util import Inches

# create Presentation
prs = Presentation()

# set layout
title_only_slidelayout = prs.slidelayouts[5]

# add slide with title layout
slide = prs.slides.add_slide(title_only_slidelayout)

# get slide list
shapes = slide.shapes

# table specs
rows, cols = 8, 2    # works with 6 rows, fails to open in Powerpoint with 8 rows
left, top = Inches(1.0), Inches(2.0)
width = Inches(8.0)
height = Inches(0.8)

# create table
tbl = shapes.add_table(rows, cols, left, top, width, height)

# save table
prs.save('table_test.pptx')

Maybe you'll have an idea as to what's going on.

Thanks!

file-like object raising attribute error

Here is the code snippet I have been trying

from base64 import decode
from pptx import Presentation
from pptx.util import Inches, Px
import StringIO

def GeneratePPT():
    prs = Presentation()

    img_str = "iVBORw0KGgoAAAANSUhEUgAAABYAAAAWCAYAAADEtGw7AAAABmJLR0QAAAAAAAD5Q7t/AAAACXBIWXMAAA3WAAAN1gGQb3mcAAAClElEQVQ4y+\
                2UP2+cRRDGf7O798fn2I7sONiKIWCwIgqUkm+AhECkpqFDFHwdGiQqmtSkicTHoEKJ5cjITiTHZ/ts3Xvvuzs7Q+GAsBQfUeo87eh5djTz24F\
                3eiW5rrD4YESX842tjfUf15ZXNhF3/NJzenExPjw6/inFdDr9rXmtP817VTu9ef/e9vef3dv6uNSO6hUcdp+dHO4/P3qYIqfXeecGE0ijxV5K\
                i5mqM8wKuDBcCBIkhHnWucEhxl7sSZK+IrESzMBBkkcRebPghW+GAKNS9I470nbZgoRPQmIgg0qoFbMKBhJJINuluA6+WoiOeYxyKDBtHrVXl\
                /fetzcx48vP73/68621peTBcKnp/bsrq4PVJqp3aFWsGvl0qR7sT06sulpxJpOsf/y5/4MEHh89PLva8XDQpxqjnY82N9c3U7JUkL7ivZYaCy\
                EYoVZqp8jyOG7s1PV2WigzZThc0eHeYCTBXj9jATdXilXMM0JFRKGneOzQMqPNHW3taLOSs1KyQR0gIj53eeaOYZgrRad0ckqRc2qakXMhZ6N\
                ko2QnF6dmoW9r/0eFAE6TL5i0z+nSGdZvoSghCV7BCognkgguIAGCxOuD2y5jTvNk78WLhZc11dAjpNvp9lZanS3txdIpOKCR0XS7vjzQE6uo\
                K5yfu866tvkvgP9S8Q9uqvVOoBeEUAV2vvj67q+jDw9uqXdgELxP+9cH498f738H/gQhmquFyKEgTfNodrXj2SV/DfAUCosPRmhGrNBpA8UAh\
                wiYuoLvhWS7b3UrqlnR7FoaJ9fLX5fEqcWr4zbPO/8IWdHciC53G0TrcIckPc7a4ObVIuHtglNPznafHf8yHt/YgPSKU5fJxfFYgo95pzfR38\
                mJgHMtR1QSAAAAInpUWHRTb2Z0d2FyZQAAeNorLy/Xy8zLLk5OLEjVyy9KBwA22AZYEFPKXAAAAABJRU5ErkJggg=="
    file_like_object = StringIO.StringIO(img_str.decode('base64'))

    slidelayout = prs.slidelayouts[0]
    slide = prs.slides.add_slide(slidelayout)
    left = top = Inches(3)
    pic = slide.shapes.add_picture(file_like_object, left, top)

    file_like_object.close()

    prs.save('Test.pptx')

if __name__ == "__main__":
    GeneratePPT()

It raises the following error:
AttributeError: StringIO instance has no attribute 'rfind'

Unicode issue on setting text in textbox

There is a problem with non-ascii characters in textbox. It can be fixed in line 1705 in presentation.py by not calling str, instead either just setting it to value or unicode(value).

Script:

# -*- coding: utf-8 -*-
from pptx import Presentation

if __name__ == '__main__':
    prs = Presentation()
    sl = prs.slidemasters[0].slidelayouts[5]
    s = prs.slides.add_slide(sl)
    tb = s.shapes.add_textbox(752777,1509138,7718035,4833392)
    p = tb.textframe.add_paragraph() 
    p.text = 'Hér er texti með íslenskum stöfum. This string contains icelandic/non-ascii characters.'
    prs.save('test.pptx')

Stacktrace:

Traceback (most recent call last):
  File "a.py", line 14, in <module>
    p.text = 'Hér er texti með íslenskum stöfum. This string contains icelandic/non-ascii characters.'
  File "/Users/vidar/.virtualenvs/DM27/src/pptx/pptx/presentation.py", line 1705, in _set_text
    r.text = str(value)
  File "/Users/vidar/.virtualenvs/DM27/src/pptx/pptx/presentation.py", line 1790, in text
    self.__t.text = str
  File "lxml.etree.pyx", line 922, in lxml.etree._Element.text.__set__ (src/lxml/lxml.etree.c:40737)
  File "apihelpers.pxi", line 656, in lxml.etree._setNodeText (src/lxml/lxml.etree.c:18467)
  File "apihelpers.pxi", line 1339, in lxml.etree._utf8 (src/lxml/lxml.etree.c:24233)
ValueError: All strings must be XML compatible: Unicode or ASCII, no NULL bytes or control characters
``` 

Save presentation to StringIO instance

It would be nice to save a presentation to a StringIO instance instead of to disk. That way you can go directly to a HttpResponse object without touching disk.

feature: set table cell background color

Hi..

I'm trying to add the ability in my code to set the background colour of the cell. This should be done similar to the font colours, by adding a solidFill etc, so I wrote:

def set_cell_background_color(cell, rgbColor):
   print "cell %r" % cell
   print "color %s" % rgbColor
   tc = cell._Cell__tc
   solidFill = _SubElement(tc, 'a:solidFill')
   srgbClr = _SubElement(solidFill, 'a:srgbClr')
   srgbClr.set('val', rgbColor)

Which I guessed as being correct after looking in shapes.py at _Cell, and seeing where it put the marL etc attributes. This ends up creating an empty tcPr element, followed by the solidFill, which Powerpoint doesn't like.

It seems that _Cell does, somehow/somewhere, create an empty tcPr element, but I can't see how to add my solidFill to it. If I change my code to:

def set_cell_background_color(cell, rgbColor):
   print "cell %r" % cell
   print "color %s" % rgbColor
   tc = cell._Cell__tc
   solidFill = _SubElement(tc, 'a:solidFill')
   srgbClr = _SubElement(solidFill, 'a:srgbClr')
   srgbClr.set('val', rgbColor)

Then I get TWO tcPr elements, which isn't allowed.

Any ideas?

(Issue completely rewritten as I was being a nitwit..)

From the relaxng spec:
a_CT_TableCell =

default value: 1

attribute rowSpan { xsd:int }?,

default value: 1

attribute gridSpan { xsd:int }?,

default value: false

attribute hMerge { xsd:boolean }?,

default value: false

attribute vMerge { xsd:boolean }?,
attribute id { xsd:string }?,
element txBody { a_CT_TextBody }?,
element tcPr { a_CT_TableCellProperties }?,
element extLst { a_CT_OfficeArtExtensionList }?

a_CT_TableCellProperties =

default value: 91440

attribute marL { a_ST_Coordinate32 }?,

default value: 91440

attribute marR { a_ST_Coordinate32 }?,

default value: 45720

attribute marT { a_ST_Coordinate32 }?,

default value: 45720

attribute marB { a_ST_Coordinate32 }?,

default value: horz

attribute vert { a_ST_TextVerticalType }?,

default value: t

attribute anchor { a_ST_TextAnchoringType }?,

default value: false

attribute anchorCtr { xsd:boolean }?,

default value: clip

attribute horzOverflow { a_ST_TextHorzOverflowType }?,
element lnL { a_CT_LineProperties }?,
element lnR { a_CT_LineProperties }?,
element lnT { a_CT_LineProperties }?,
element lnB { a_CT_LineProperties }?,
element lnTlToBr { a_CT_LineProperties }?,
element lnBlToTr { a_CT_LineProperties }?,
element cell3D { a_CT_Cell3D }?,
a_EG_FillProperties?,
element headers { a_CT_Headers }?,
element extLst { a_CT_OfficeArtExtensionList }?

rels: Support external relationships

Hello!

I was wondering (and hoping I simply missed it) if there was any support for charts and graphs embedded in Powerpoint linked from Excel? When I call the Presentation class on a pptx file with linked objects, it fails to open and results in an incorrect mapping exception. For my own personal use, I don't necessarily need to make the presentation, but simply open an existing presentation and update the linked charts and graphs. Thank you!

Add support for AutoShapes

Add API to add a preset geometry shape to a slide. A preset geometry shape is a standard geometric shape like a rectangle, elipse, or star that can be added to a slide using the "Insert Shape" menu in PowerPoint. These shapes can contain text, and can have a styled outline, fill, and fill effect.

picture: DPI-sensitive picture sizing

python-pptx v0.2.6 unconditionally uses a platform-dependent default DPI value for images added to a slide with _SlideCollection.add_picture().

Enhance the code to use the DPI setting stored as an attribute of the image stream, if present, to calculate the display size of the placed image.

This gist contains some code that adjusts size of image placed with shapes.add_picture() based on the DPI stated in the image file header.

<script src="https://gist.github.com/scanny/6833945.js"></script>

I would like to be able to include a standard footer in the slides

Footer should contain :

  • date of creation of the pptx
  • standard footer text : like company name
  • slide nr

All like in Powerpoint.

Powerpoint seems to handle this only if you have slides in the pptx.

I'm using an empty base pptx as template, so I do not get this footer in the generated pptx.

What is the best practice for this ?

feature: shape line color

It should be possible to indicate that a textframe should have a border and the color of the line

tox: add Python 3 support

Add support for Python 3.

  • Change PIL dependency to Pillow
  • Add Python 3.2, 3.3, and 3.4 environments to tox.ini.

I would like to be able to convert a textfile with markdown syntax to slides

USER STORY

I would like to be able to convert a textfile with markdown syntax to slides

DESCRIPTION

Markdown headers and bullet points should be translated to slides and bullets as follows:

  • H1 text should become a Title slide
  • H2 text should become the title of a Content slide
  • H3,4,5,6 and bullet points should become bullet points in the content slide

All other text should be added to the slide notes

feature: delete picture

Request for method to delete an existing picture in a presentation. An example use is to allow an existing slide deck to be repurposed by simply changing the customer logo in the deck.

shape: Querying shape size and position

Request for support to query the position and size of an existing shape (and set them to new values?)

One use is to allow an existing image in presentation to be characterized, so that it can be replaced with an image of the same size and resolution.

Shapes of the following types can appear in Slide.shapes (<p:spTree>) and each will require support:

  • sp -- Auto Shape
  • pic -- Picture
  • grpSp -- Group Shape
  • graphicFrame -- container for table and chart shapes
  • cxnSp -- Connector (line)
  • contentPart -- has no position, but should return None instead of raising an exception

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.