[reportlab-users] Reducing the margin of a table

Claudio Battaglino c.battaglino at icube.it
Wed Jun 29 03:31:20 EDT 2005


Hi,
I'd like to generate a page with a single table with margin = 0.
That is the table should fill all the page.
I tried it and the result is in the attachment.
As you can see I don't have a null margin and between the table and the
border of the page I've an empty space.
How can I have a table that fills all the page?


* The page is a SimpleDocTemplate page with margins set to 0:

      PAGE_WIDTH = 5.5 * cm
      PAGE_HEIGHT = 2.2 * cm

      def _createDoc(self):
          return SimpleDocTemplate(self.name,
              pagesize=(self.PAGE_WIDTH, self.PAGE_HEIGHT),
              bottomMargin=0, topMargin=0, rightMargin=0, leftMargin=0)

* The table has the same dimensions of the page:
class AbstractLabelTable:

          def __init__(self, reg, metamapper):
    		...
              self.cells_style = self._getCellStyle()
              self.tableData = []

          def  _getCellStyle(self):
              return [ ('VALIGN',(0,0),(-1,-1),'BOTTOM'),
                  ('ALIGN',(0,0),(-1,-1),'LEFT'),
                  ('LEADING',(0,0),(-1,-1), 0),
                  ('LEFTPADDING',(0,0),(-1,-1), 0),
                  ('RIGHTPADDING',(0,0),(-1,-1), 0),
                  ('BOX',(0,0),(-1,-1), 0.1, colors.black)]

          def _getColumnWidth(self):
              return [5.5 * cm]
      	...
          def _addICParagraph(self):
              P_last = Paragraph("<para align=left>%s</para>" %
self.ic_string, self.style)
              self.tableData.append([P_last])

          def compute(self):
              self._addTitleParagraph()
              self._addProtocolParagraph()
              self._addDateParagraph()
              self._addICParagraph()
              self._addIndexParagraph()
              table = Table(self.tableData, colWidths=self.column_width,
                  style=self.cells_style)
              return table

Thank you very much


claudio :-)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: seg.pdf
Type: application/pdf
Size: 24759 bytes
Desc: not available
Url : http://two.pairlist.net/pipermail/reportlab-users/attachments/20050629/4f426036/seg-0001.pdf


More information about the reportlab-users mailing list