当前位置: 首页>>代码示例>>Python>>正文


Python platypus.TableStyle方法代码示例

本文整理汇总了Python中reportlab.platypus.TableStyle方法的典型用法代码示例。如果您正苦于以下问题:Python platypus.TableStyle方法的具体用法?Python platypus.TableStyle怎么用?Python platypus.TableStyle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在reportlab.platypus的用法示例。


在下文中一共展示了platypus.TableStyle方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: gather_elements

# 需要导入模块: from reportlab import platypus [as 别名]
# 或者: from reportlab.platypus import TableStyle [as 别名]
def gather_elements(self, client, node, style):
        # A field has two child elements, a field_name and a field_body.
        # We render as a two-column table, left-column is right-aligned,
        # bold, and much smaller

        fn = Paragraph(
            client.gather_pdftext(node.children[0]) + ":",
            style=client.styles['fieldname'],
        )
        fb = client.gen_elements(node.children[1], style=client.styles['fieldvalue'])
        t_style = TableStyle(client.styles['field-list'].commands)
        return [
            DelayedTable(
                [[fn, fb]],
                style=t_style,
                colWidths=client.styles['field-list'].colWidths,
            )
        ] 
开发者ID:rst2pdf,项目名称:rst2pdf,代码行数:20,代码来源:genelements.py

示例2: __init__

# 需要导入模块: from reportlab import platypus [as 别名]
# 或者: from reportlab.platypus import TableStyle [as 别名]
def __init__(self, to_addr_lines, from_name_lines, date=None,
                 closing="Yours truly", signer=None, paragraphs=None, cosigner_lines=None, use_sig=True,
                 body_font_size=None, cc_lines=None):
        self.date = date or datetime.date.today()
        self.closing = closing
        self.flowables = []
        self.to_addr_lines = to_addr_lines
        self.from_name_lines = from_name_lines
        self.cosigner_lines = cosigner_lines
        self.signer = signer
        self.use_sig = use_sig
        if cc_lines:
            self.cc_lines = [cc for cc in cc_lines if cc.strip()]
        else:
            self.cc_lines = None
        if paragraphs:
            self.add_paragraphs(paragraphs)

        # styles
        self.line_height = (body_font_size or 12) + 1
        self.content_style = ParagraphStyle(name='Normal',
                                            fontName='BemboMTPro',
                                            fontSize=body_font_size or 12,
                                            leading=self.line_height,
                                            allowWidows=0,
                                            allowOrphans=0,
                                            alignment=TA_JUSTIFY,
                                            textColor=black)
        self.table_style = TableStyle([
                    ('FONT', (0,0), (-1,-1), 'BemboMTPro', 12, self.line_height),
                    ('TOPPADDING', (0,0), (-1,-1), 0),
                    ('BOTTOMPADDING', (0,0), (-1,-1), 0),
                    ]) 
开发者ID:sfu-fas,项目名称:coursys,代码行数:35,代码来源:letters.py

示例3: _contents

# 需要导入模块: from reportlab import platypus [as 别名]
# 或者: from reportlab.platypus import TableStyle [as 别名]
def _contents(self, memo):
        """
        Produce a list of Flowables to form the body of the memo
        """
        contents = []
        space_height = self.line_height
        # the header block
        contents.append(MemoHead(key='Attention', value=', '.join(self.to_addr_lines), bold=True))
        contents.append(MemoHead(key='From', value=', '.join(self.from_name_lines)))
        contents.append(MemoHead(key='Re', value=self.subject[0]))
        for subjectline in self.subject[1:]:
            contents.append(MemoHead(key='', value=subjectline))
        contents.append(MemoHead(key='Date', value=self.date.strftime('%B %d, %Y').replace(' 0', ' ')))
        contents.append(Spacer(1, 2*space_height))

        # insert each paragraph
        for f in self.flowables:
            contents.append(f)
            #contents.append(Spacer(1, space_height))

        # the CC lines
        if self.cc_lines:
            data = []
            for cc in self.cc_lines:
                data.append(['', Paragraph(cc, self.content_style)])

            cc = Paragraph('cc:', self.content_style)
            data[0][0] = cc

            cc_table = Table(data, colWidths=[0.3 * inch, 5 * inch])
            cc_table.hAlign = "LEFT"
            cc_table.setStyle(TableStyle(
                [('LEFTPADDING', (0, 0), (-1, -1), 0),
                 ('RIGHTPADDING', (0, 0), (-1, -1), 0),
                 ('TOPPADDING', (0, 0), (-1, -1), 0),
                 ('BOTTOMPADDING', (0, 0), (-1, -1), 0)]))

            contents.append(cc_table)
        return contents 
开发者ID:sfu-fas,项目名称:coursys,代码行数:41,代码来源:letters.py

示例4: __init__

# 需要导入模块: from reportlab import platypus [as 别名]
# 或者: from reportlab.platypus import TableStyle [as 别名]
def __init__(self, data, horizontal_align=None, style=None):
        Table.__init__(self, data, hAlign=horizontal_align)

        default_style = [
            ('INNERGRID', (0, 0), (-1, -1), .25, colors.black),
            ('BOX', (0, 0), (-1, -1), .25, colors.black),
            ('BACKGROUND', (0, 0), (-1, -len(data)), colors.lightgrey),
            ('ALIGN', (0, 0), (-1, -1), 'CENTER'),
            ('VALIGN', (0, 0), (-1, -1), 'MIDDLE')
        ]

        if style and isinstance(style, list):
            default_style.extend(style)

        self.setStyle(TableStyle(default_style)) 
开发者ID:CiCiApp,项目名称:PyInvoice,代码行数:17,代码来源:components.py

示例5: create_hdr

# 需要导入模块: from reportlab import platypus [as 别名]
# 或者: from reportlab.platypus import TableStyle [as 别名]
def create_hdr(self, name, font_size):
        hdr_style = TableStyle([('TEXTCOLOR', (0, 0), (-1, -1), colors.black),
                                ('BOTTOMPADDING', (0, 0), (-1, -1), 15),
                                ('TOPPADDING', (0, 0), (-1, -1), 15),
                                ('FONTSIZE', (0, 0), (-1, -1), 8),
                                ('VALIGN', (0, 0), (-1, -1), 'TOP'),
                                ('ALIGN', (0, 0), (-1, 0), 'LEFT'),
                                ('LINEBELOW', (0, 0), (-1, -1), 2, colors.black),
                                ('BACKGROUND', (0, 1), (-1, -1), colors.white)])        
        
        name_p = Paragraph(name, ParagraphStyle("Category name style", fontSize=font_size))
        hdr_tbl = Table([[name_p]], colWidths = 500, rowHeights = None, repeatRows = 1)
        hdr_tbl.setStyle(hdr_style)
        self.elements.append(hdr_tbl) 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:16,代码来源:fd_api_doc.py

示例6: _posting_list_table

# 需要导入模块: from reportlab import platypus [as 别名]
# 或者: from reportlab.platypus import TableStyle [as 别名]
def _posting_list_table(self, canvas, x1, y1, x2, y2, shipping_labels):
        style = self.table_style[:]
        table = [self.table_header]
        for i, shipping_label in enumerate(shipping_labels, start=1):
            row = (
                str(shipping_label.tracking_code),
                str(shipping_label.receiver.zip_code),
                str(shipping_label.package.weight),
                self.yes if ExtraService.get(EXTRA_SERVICE_AR) in shipping_label else self.no,
                self.yes if ExtraService.get(EXTRA_SERVICE_MP) in shipping_label else self.no,
                self.yes if shipping_label.has_declared_value() else self.no,
                str(shipping_label.value).replace(".", ",") if shipping_label.value is not None else "",
                str(shipping_label.invoice_number),
                shipping_label.get_package_sequence(),
                shipping_label.receiver.name[: self.max_receiver_name_size],
            )

            # noinspection PyTypeChecker
            table.append(row)

            if i % 2:
                style.append(("BACKGROUND", (0, i), (-1, i), colors.lightgrey))

        table_flow = Table(table, colWidths=self.col_widths, style=TableStyle(style))
        w, h = table_flow.wrap(0, 0)
        table_flow.drawOn(canvas, x1, y2 - h - 50 * mm) 
开发者ID:olist,项目名称:correios,代码行数:28,代码来源:pdf.py

示例7: style_and_data

# 需要导入模块: from reportlab import platypus [as 别名]
# 或者: from reportlab.platypus import TableStyle [as 别名]
def style_and_data(self):
        if self._style_and_data is None:
            data = self.tb.formatted_values.values.tolist()
            style = TableStyle(self.tb.style_cmds)
            self._style_and_data = style, data
        return self._style_and_data 
开发者ID:bpsmith,项目名称:tia,代码行数:8,代码来源:table.py

示例8: gather_elements

# 需要导入模块: from reportlab import platypus [as 别名]
# 或者: from reportlab.platypus import TableStyle [as 别名]
def gather_elements(self, client, node, style):
        # Each child is a hlistcol and represents a column.
        # Each grandchild is a bullet list that's the contents
        # of the column

        # Represent it as a N-column, 1-row table, each cell containing
        # a list.

        cells = [[client.gather_elements(child, style) for child in node.children]]
        t_style = TableStyle(client.styles['hlist'].commands)
        cw = 100.0 / len(node.children)
        return [
            DelayedTable(cells, colWidths=["%s%%" % cw,] * len(cells), style=t_style)
        ] 
开发者ID:rst2pdf,项目名称:rst2pdf,代码行数:16,代码来源:sphinxnodes.py


注:本文中的reportlab.platypus.TableStyle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。