Search code examples
pythonpdf-generationreportlab

from reportlab.platypus import ListFlowable, ListItem not working


I am a newbie to python. I have to create an ordered list in my pdf document using Reportlab. I found these two classes ListFlowable(), ListItem() in the user-guide of Reportlab to do the same. But the very first import statement for these classes is not working.

from reportlab.platypus import ListFlowable, ListItem

This statement gives me the following error:

ImportError: cannot import name ListFlowable

How can I use these classes? I am using python 2.6, reportlab 2.5.


Solution

  • In my install of ReportLab 2.5 this isn't available. I see it's there in the documentation, but searching through the code there is no such thing as a ListFlowable or ListItem. This might be something that's only available in the closed-source portion of ReportLab and not the open source.

    If you need to make lists, though, you can fairly easily get similar results using iterator variables and paragraph styles. That's the way I've always done it.