'Internally used method to adjust the table so that it will fit
into the available space on the page.
@return: True if it is able to perform minor adjustments and have
the table fit in the page. False means that the table will need to
be split across the columns.'

def tweakDoc(self, table):

    tableWidth = 0
    for colWidth in table._colWidths:
        tableWidth += colWidth
    colWidths = table._colWidths
    if (tableWidth > self.tempDoc.printable_width):
        colNo = 0
        for label in self.labels:
            if (label.lower() == 'comments'):
                currentWidth = table._colWidths[colNo]
                if (currentWidth > self.MIN_COMMENT_COL_WIDTH):
                    for i in range(1, len(self.data)):
                        try:
                            comments = self.data[i][colNo]
                            if comments:
                                comments = self.pdf.addParagraph(comments, append=False)
                                self.data[i][colNo] = comments
                        except IndexError:
                            pass
                    colWidths[colNo] = self.MIN_COMMENT_COL_WIDTH
                    tableWidth += (self.MIN_COMMENT_COL_WIDTH - currentWidth)
            colNo += 1
        if (not self.minorTweaks(tableWidth, colWidths)):
            self.tempDoc.defaultPage = 'Landscape'
            self.tempDoc._calc()
            self.pdf.defaultPage = 'Landscape'
            self.pdf._calc()
            return self.minorTweaks(tableWidth, colWidths)
    return True
