本文整理汇总了Python中reportlab.lib.styles.ParagraphStyle.bulletFontSize方法的典型用法代码示例。如果您正苦于以下问题:Python ParagraphStyle.bulletFontSize方法的具体用法?Python ParagraphStyle.bulletFontSize怎么用?Python ParagraphStyle.bulletFontSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类reportlab.lib.styles.ParagraphStyle
的用法示例。
在下文中一共展示了ParagraphStyle.bulletFontSize方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: toParagraphStyle
# 需要导入模块: from reportlab.lib.styles import ParagraphStyle [as 别名]
# 或者: from reportlab.lib.styles.ParagraphStyle import bulletFontSize [as 别名]
def toParagraphStyle(self, first, full=False):
style = ParagraphStyle('default%d' % self.UID(), keepWithNext=first.keepWithNext)
style.fontName = first.fontName
style.fontSize = first.fontSize
style.leading = max(first.leading, first.fontSize * 1.25)
style.backColor = first.backColor
style.spaceBefore = first.spaceBefore
style.spaceAfter = first.spaceAfter
style.leftIndent = first.leftIndent
style.rightIndent = first.rightIndent
style.firstLineIndent = first.firstLineIndent
style.textColor = first.textColor
style.alignment = first.alignment
style.bulletFontName = first.bulletFontName or first.fontName
style.bulletFontSize = first.fontSize
style.bulletIndent = first.bulletIndent
# Border handling for Paragraph
style.borderWidth = 0
if getBorderStyle(first.borderTopStyle):
style.borderWidth = max(first.borderLeftWidth, first.borderRightWidth, first.borderTopWidth, first.borderBottomWidth)
style.borderPadding = first.borderPadding # + first.borderWidth
style.borderColor = first.borderTopColor
# If no border color is given, the text color is used (XXX Tables!)
if (style.borderColor is None) and style.borderWidth:
style.borderColor = first.textColor
if full:
style.fontName = tt2ps(first.fontName, first.bold, first.italic)
return style
示例2: addPara
# 需要导入模块: from reportlab.lib.styles import ParagraphStyle [as 别名]
# 或者: from reportlab.lib.styles.ParagraphStyle import bulletFontSize [as 别名]
def addPara(self, force=False):
# Cleanup the trail
for frag in reversed(self.fragList):
frag.text = frag.text.rstrip()
if frag.text:
break
if force or (self.text.strip() and self.fragList):
# Strip trailing whitespaces
# for f in self.fragList:
# f.text = f.text.lstrip()
# if f.text:
# break
# self.fragList[-1].lineBreak = self.fragList[-1].text.rstrip()
# Update paragraph style by style of first fragment
first = self.fragBlock
style = ParagraphStyle("default%d" % self.UID(), keepWithNext=first.keepWithNext)
style.fontName = first.fontName
style.fontSize = first.fontSize
style.leading = max(first.leading, first.fontSize * 1.25)
style.backColor = first.backColor
style.spaceBefore = first.spaceBefore
style.spaceAfter = first.spaceAfter
style.leftIndent = first.leftIndent
style.rightIndent = first.rightIndent
style.firstLineIndent = first.firstLineIndent
style.alignment = first.alignment
style.bulletFontName = first.fontName
style.bulletFontSize = first.fontSize
style.bulletIndent = first.bulletIndent
style.borderWidth = max(
first.borderLeftWidth, first.borderRightWidth, first.borderTopWidth, first.borderBottomWidth
)
style.borderPadding = first.borderPadding # + first.borderWidth
style.borderColor = first.borderTopColor
# borderRadius: None,
# print repr(self.text.strip()), style.leading, "".join([repr(x.text) for x in self.fragList])
# print first.leftIndent, first.listStyleType,repr(self.text)
# Add paragraph to story
para = PmlParagraph(
self.text, style, frags=self.fragAnchor + self.fragList, bulletText=copy.copy(first.bulletText)
)
para.outline = frag.outline
para.outlineLevel = frag.outlineLevel
para.outlineOpen = frag.outlineOpen
self.addStory(para)
self.fragAnchor = []
first.bulletText = None
self.clearFrag()
示例3: toParagraphStyle
# 需要导入模块: from reportlab.lib.styles import ParagraphStyle [as 别名]
# 或者: from reportlab.lib.styles.ParagraphStyle import bulletFontSize [as 别名]
def toParagraphStyle(self, first):
style = ParagraphStyle('default%d' % self.UID(), keepWithNext=first.keepWithNext)
style.fontName = first.fontName
style.fontSize = first.fontSize
style.letterSpacing = first.letterSpacing
style.leading = max(first.leading + first.leadingSpace, first.fontSize * 1.25)
style.backColor = first.backColor
style.spaceBefore = first.spaceBefore
style.spaceAfter = first.spaceAfter
style.leftIndent = first.leftIndent
style.rightIndent = first.rightIndent
style.firstLineIndent = first.firstLineIndent
style.textColor = first.textColor
style.alignment = first.alignment
style.bulletFontName = first.bulletFontName or first.fontName
style.bulletFontSize = first.fontSize
style.bulletIndent = first.bulletIndent
style.wordWrap = first.wordWrap
# Border handling for Paragraph
# Transfer the styles for each side of the border, *not* the whole
# border values that reportlab supports. We'll draw them ourselves in
# PmlParagraph.
style.borderTopStyle = first.borderTopStyle
style.borderTopWidth = first.borderTopWidth
style.borderTopColor = first.borderTopColor
style.borderBottomStyle = first.borderBottomStyle
style.borderBottomWidth = first.borderBottomWidth
style.borderBottomColor = first.borderBottomColor
style.borderLeftStyle = first.borderLeftStyle
style.borderLeftWidth = first.borderLeftWidth
style.borderLeftColor = first.borderLeftColor
style.borderRightStyle = first.borderRightStyle
style.borderRightWidth = first.borderRightWidth
style.borderRightColor = first.borderRightColor
# If no border color is given, the text color is used (XXX Tables!)
if (style.borderTopColor is None) and style.borderTopWidth:
style.borderTopColor = first.textColor
if (style.borderBottomColor is None) and style.borderBottomWidth:
style.borderBottomColor = first.textColor
if (style.borderLeftColor is None) and style.borderLeftWidth:
style.borderLeftColor = first.textColor
if (style.borderRightColor is None) and style.borderRightWidth:
style.borderRightColor = first.textColor
style.borderPadding = first.borderPadding
style.paddingTop = first.paddingTop
style.paddingBottom = first.paddingBottom
style.paddingLeft = first.paddingLeft
style.paddingRight = first.paddingRight
style.fontName = tt2ps(first.fontName, first.bold, first.italic)
return style
示例4: toParagraphStyle
# 需要导入模块: from reportlab.lib.styles import ParagraphStyle [as 别名]
# 或者: from reportlab.lib.styles.ParagraphStyle import bulletFontSize [as 别名]
def toParagraphStyle(self, first):
style = ParagraphStyle(
'default%d' % self.UID(), keepWithNext=first.keepWithNext)
copy_attrs(style, first,
('fontName', 'fontSize', 'letterSpacing', 'backColor',
'spaceBefore', 'spaceAfter', 'leftIndent', 'rightIndent',
'firstLineIndent', 'textColor', 'alignment',
'bulletIndent', 'wordWrap', 'borderTopStyle',
'borderTopWidth', 'borderTopColor',
'borderBottomStyle', 'borderBottomWidth',
'borderBottomColor', 'borderLeftStyle',
'borderLeftWidth', 'borderLeftColor',
'borderRightStyle', 'borderRightWidth',
'borderRightColor', 'paddingTop', 'paddingBottom',
'paddingLeft', 'paddingRight', 'borderPadding'
)
)
style.leading = max(
first.leading + first.leadingSpace, first.fontSize * 1.25)
style.bulletFontName = first.bulletFontName or first.fontName
style.bulletFontSize = first.fontSize
# Border handling for Paragraph
# Transfer the styles for each side of the border, *not* the whole
# border values that reportlab supports. We'll draw them ourselves in
# PmlParagraph.
# If no border color is given, the text color is used (XXX Tables!)
if (style.borderTopColor is None) and style.borderTopWidth:
style.borderTopColor = first.textColor
if (style.borderBottomColor is None) and style.borderBottomWidth:
style.borderBottomColor = first.textColor
if (style.borderLeftColor is None) and style.borderLeftWidth:
style.borderLeftColor = first.textColor
if (style.borderRightColor is None) and style.borderRightWidth:
style.borderRightColor = first.textColor
style.fontName = tt2ps(first.fontName, first.bold, first.italic)
return style
示例5: toParagraphStyle
# 需要导入模块: from reportlab.lib.styles import ParagraphStyle [as 别名]
# 或者: from reportlab.lib.styles.ParagraphStyle import bulletFontSize [as 别名]
def toParagraphStyle(self, first, full=False):
style = ParagraphStyle('default%d' % self.UID(), keepWithNext=first.keepWithNext)
style.fontName = first.fontName
style.fontSize = first.fontSize
style.leading = max(first.leading, first.fontSize * 1.25)
style.backColor = first.backColor
style.spaceBefore = first.spaceBefore
style.spaceAfter = first.spaceAfter
style.leftIndent = first.leftIndent
style.rightIndent = first.rightIndent
style.firstLineIndent = first.firstLineIndent
style.textColor = first.textColor
style.alignment = first.alignment
style.bulletFontName = first.bulletFontName or first.fontName
style.bulletFontSize = first.fontSize
style.bulletIndent = first.bulletIndent
# Border handling for Paragraph
# Transfer the styles for each side of the border, *not* the whole
# border values that reportlab supports. We'll draw them ourselves in
# PmlParagraph.
style.borderTopStyle = first.borderTopStyle
style.borderTopWidth = first.borderTopWidth
style.borderTopColor = first.borderTopColor
style.borderBottomStyle = first.borderBottomStyle
style.borderBottomWidth = first.borderBottomWidth
style.borderBottomColor = first.borderBottomColor
style.borderLeftStyle = first.borderLeftStyle
style.borderLeftWidth = first.borderLeftWidth
style.borderLeftColor = first.borderLeftColor
style.borderRightStyle = first.borderRightStyle
style.borderRightWidth = first.borderRightWidth
style.borderRightColor = first.borderRightColor
# If no border color is given, the text color is used (XXX Tables!)
if (style.borderTopColor is None) and style.borderTopWidth:
style.borderTopColor = first.textColor
if (style.borderBottomColor is None) and style.borderBottomWidth:
style.borderBottomColor = first.textColor
if (style.borderLeftColor is None) and style.borderLeftWidth:
style.borderLeftColor = first.textColor
if (style.borderRightColor is None) and style.borderRightWidth:
style.borderRightColor = first.textColor
style.borderPadding = first.borderPadding
style.paddingTop = first.paddingTop
style.paddingBottom = first.paddingBottom
style.paddingLeft = first.paddingLeft
style.paddingRight = first.paddingRight
# This is the old code replaced by the above, kept for reference
#style.borderWidth = 0
#if getBorderStyle(first.borderTopStyle):
# style.borderWidth = max(first.borderLeftWidth, first.borderRightWidth, first.borderTopWidth, first.borderBottomWidth)
# style.borderPadding = first.borderPadding # + first.borderWidth
# style.borderColor = first.borderTopColor
# # If no border color is given, the text color is used (XXX Tables!)
# if (style.borderColor is None) and style.borderWidth:
# style.borderColor = first.textColor
if full:
style.fontName = tt2ps(first.fontName, first.bold, first.italic)
return style
示例6: get_document_pdf
# 需要导入模块: from reportlab.lib.styles import ParagraphStyle [as 别名]
# 或者: from reportlab.lib.styles.ParagraphStyle import bulletFontSize [as 别名]
def get_document_pdf(filename, doc_id, start_index=1):
doc = get_doc_copy_with_references(doc_id, start_index=1)
story = [Spacer(1,10*cm)]
if doc.get('intro', None):
story.append(P(doc['intro_header'] or 'Scope of the invitation to Tender',styleH1))
styleP = copy.deepcopy(styleN)
styleP.firstLineIndent=20
styleP.alignment = TA_JUSTIFY
for p in doc['intro'].replace('\r','').split('\n'):
if not p: # empty line:
story.append(Spacer(1,12))
else:
story.append(P(p, styleP))
styleN.alignment = TA_JUSTIFY
H1 = partial(Paragraph, style=styleH1)
H2 = partial(Paragraph, style=styleH2)
H3 = partial(Paragraph, style=styleH3)
N = partial(Paragraph, style=styleN)
for s in [styleH1, styleH2, styleH3]:
s.bulletFontSize = s.fontSize
indent=30
styleH1L1 = ParagraphStyle(name='H1L1', parent=styleH1, leftIndent=indent, bulletIndent=indent)
styleH1L1.bulletFontSize = styleH1.bulletFontSize
H1L1 = partial(Paragraph,style=styleH1L1)
styleH2L1 = ParagraphStyle(name='H2L1', parent=styleH2, leftIndent=indent, bulletIndent=indent)
H2L1 = partial(Paragraph, style=styleH2L1)
styleNL1 = ParagraphStyle(name='NL1', parent=styleN, leftIndent=indent*2, bulletIndent=indent, spaceAfter=5)
NL1 = partial(Paragraph, style=styleNL1)
for sys in range(len(doc.get('systems',[]))):
system = doc['systems'][sys]
bt = "%d" % (start_index + sys)
story.append(Spacer(1,cm))
story.append(
H1(system['name'], bulletText = bt )
)
if system['description']:
story.append(N(system['description']))
# due to this http://two.pairlist.net/pipermail/reportlab-users/2008-January/006676.html
# the use of a table is not suitable. I will build the list with bulleted paragraphs
for sec in range(len(system.get('sections',[]))):
section=system['sections'][sec]
bt = '%d.%d' % (start_index + sys, sec+1)
story.append(
H2(section['header'], bulletText=bt)
)
if section['description']:
story.append(N(section['description']))
for q in range(len(section.get('questions',[]))):
question = section['questions'][q]
bt = "%d.%d.%d" % (start_index + sys, sec+1, q+1)
story.append(NL1(question['tech_spec'], bulletText=bt))
if doc.get('contacts', None):
contacts_per_row=3
_cs = copy.deepcopy(doc.get('contacts',[]))
table_data = []
# let's pad the table
while len(_cs) % contacts_per_row != 0:
_cs.append(dict({u'type_':'', u'name':'', u'address':'',u'tel':'',u'fax':'', u'email':''}))
stack = []
for ci in range(len(_cs)):
stack.append(_cs[ci])
if len(stack) == contacts_per_row:
table_data.append([ u''] + [c['type_']+':' if c['type_'] else '' for c in stack])
table_data.append([u'Name'] + [c['name'] for c in stack])
table_data.append([u'Address'] + [c['address'].replace('\r','') for c in stack])
table_data.append([u'Tel'] + [c['tel'] for c in stack])
table_data.append([u'Fax'] + [c['fax'] for c in stack])
table_data.append([u'E-mail'] + [c['email'] for c in stack])
table_data.append([u'']*(contacts_per_row+1))
stack=[]
table_style=TableStyle([('VALIGN',(0,0), (-1,-1), 'TOP'),
('ALIGN', (0,0), (0,-1), 'LEFT'),
('ALIGN', (0,0), (0,-1), 'RIGHT'),
#('GRID',(0,0), (-1,-1), 0.25, colors.black)
])
table=Table(table_data, colWidths=[2.5*cm]+[4.5*cm]*contacts_per_row, style=table_style)
#story.append(Spacer(1,cm))
story.append(PageBreak()) # as requested now there is a PageBreak before the Contacts
story.append(H1('Contacts'))
story.append(table)
#.........这里部分代码省略.........
示例7: createPDF
# 需要导入模块: from reportlab.lib.styles import ParagraphStyle [as 别名]
# 或者: from reportlab.lib.styles.ParagraphStyle import bulletFontSize [as 别名]
#.........这里部分代码省略.........
styles['Heading4'].allowWidows = 0
styles['Heading4'].fontName = 'Helvetica-Bold'
styles['Heading4'].fontSize = 10
styles['Heading4'].leading = 12
styles['Heading4'].spaceAfter = 6
styles['Heading4'].textColor = header_rgb
th_cell = ParagraphStyle('TableHeading')
th_cell.spaceBefore = 3
th_cell.spaceAfter = 6
th_cell.fontSize = 10
th_cell.fontName = 'Times-Bold'
td_cell = ParagraphStyle('TableData')
td_cell.spaceBefore = 3
td_cell.spaceAfter = 6
td_cell.fontSize = 10
td_cell.fontName = 'Times-Roman'
td_cell_right = ParagraphStyle('TableDataRight')
td_cell_right.spaceBefore = 3
td_cell_right.spaceAfter = 6
td_cell_right.fontSize = 10
td_cell_right.fontName = 'Times-Roman'
td_cell_right.alignment = TA_RIGHT
bullet_list = ParagraphStyle('BulletList')
bullet_list.spaceBefore = 4
bullet_list.spaceAfter = 4
bullet_list.fontName = 'Times-Roman'
bullet_list.bulletIndent = 5
bullet_list.leftIndent = 17
bullet_list.bulletFontSize = 12
blockquote = ParagraphStyle('Blockquote')
blockquote.leftIndent = 12
blockquote.rightIndent = 8
blockquote.spaceAfter = 6
blockquote.fontName = 'Times-Roman'
discreet = ParagraphStyle('Discreet')
discreet.fontSize = 9
discreet.textColor = HexColor('#717171')
discreet.spaceAfter = 12
discreet.spaceBefore = 1
callout = ParagraphStyle('Callout')
callout.fontSize = 10
callout.textColor = header_rgb
callout.spaceAfter = 20
callout.spaceBefore = 22
callout.backColor = callout_background_rgb
callout.borderColor = header_rgb
callout.borderWidth = 1
callout.borderPadding = (8, 12, 10, 12)
callout.rightIndent = 15
callout.leftIndent = 15
statement = ParagraphStyle('Statement')
statement.fontSize = 8
statement.fontName = 'Times-Roman'
statement.spaceAfter = 5
statement.leading = 10
description = ParagraphStyle('Description')