0

I have a problem in formating pdf report. One value in my record list is a big text, that need to be wrap and the size of row must cover all text. I've tried by using bbox option from: https://matplotlib.org/stable/api/transformations.html#matplotlib.transforms.Bbox ,but I need only one- the last 4th parameter, which will be change dynamically from the length of text. I'm not sure how to sapare it from previous ones..and finally is it correct road to establish the height of table

Thanks for every kind of help!

the whole code looks that (it genereted raport, but I can't publish it):

            wrapError = ('\n' + ' ').join(wrapError)
            ErorrsInTable = {'clas':[clas],'path':[path],'translate':[translate], 'full content':[wrapError], 'row of Error':[rowError], 'column of Error':[columnError]}#'wrapError' set the length of row
            df = pd.DataFrame(ErorrsInTable)
            fig, ax = plt.subplots(figsize=(26,0.01*len(wrapError)))#size of window
            plt.subplots_adjust(left = 0.1, top = 0.95)
            tytul=plt.title('Report of errors', fontweight="bold")
            ax.axis('auto')
            ax.axis('off')
            the_table = ax.table(cellText=df.values, cellLoc='center', rowLoc='center',  colLabels=df.columns, loc='upper center', bbox=[0,0,0,0.01*len(wrapError)],  edges='closed')#here is the problematic bbox
            the_table.auto_set_font_size(False)
            the_table.set_fontsize(8)
            the_table.auto_set_column_width(col=list(range(len(df.columns))))
            the_table.scale(0,0.01*len(wrapError))
            cellDict = the_table.get_celld()
     ...
            pp = PdfPages(str(path)+ "\errorReports.pdf")
            print ("report was created")
            pp.savefig(fig)
            pp.close()```

0 Answers0