Coverage for /var/srv/projects/api.amasfac.comuna18.com/tmp/venv/lib/python3.9/site-packages/openpyxl/styles/table.py: 74%
40 statements
« prev ^ index » next coverage.py v6.4.4, created at 2023-07-17 14:22 -0600
« prev ^ index » next coverage.py v6.4.4, created at 2023-07-17 14:22 -0600
1# Copyright (c) 2010-2022 openpyxl
3from openpyxl.descriptors.serialisable import Serialisable
4from openpyxl.descriptors import (
5 Typed,
6 Float,
7 Bool,
8 Set,
9 Integer,
10 NoneSet,
11 String,
12 Sequence
13)
15from .colors import Color
18class TableStyleElement(Serialisable):
20 tagname = "tableStyleElement"
22 type = Set(values=(['wholeTable', 'headerRow', 'totalRow', 'firstColumn',
23 'lastColumn', 'firstRowStripe', 'secondRowStripe', 'firstColumnStripe',
24 'secondColumnStripe', 'firstHeaderCell', 'lastHeaderCell',
25 'firstTotalCell', 'lastTotalCell', 'firstSubtotalColumn',
26 'secondSubtotalColumn', 'thirdSubtotalColumn', 'firstSubtotalRow',
27 'secondSubtotalRow', 'thirdSubtotalRow', 'blankRow',
28 'firstColumnSubheading', 'secondColumnSubheading',
29 'thirdColumnSubheading', 'firstRowSubheading', 'secondRowSubheading',
30 'thirdRowSubheading', 'pageFieldLabels', 'pageFieldValues']))
31 size = Integer(allow_none=True)
32 dxfId = Integer(allow_none=True)
34 def __init__(self,
35 type=None,
36 size=None,
37 dxfId=None,
38 ):
39 self.type = type
40 self.size = size
41 self.dxfId = dxfId
44class TableStyle(Serialisable):
46 tagname = "tableStyle"
48 name = String()
49 pivot = Bool(allow_none=True)
50 table = Bool(allow_none=True)
51 count = Integer(allow_none=True)
52 tableStyleElement = Sequence(expected_type=TableStyleElement, allow_none=True)
54 __elements__ = ('tableStyleElement',)
56 def __init__(self,
57 name=None,
58 pivot=None,
59 table=None,
60 count=None,
61 tableStyleElement=(),
62 ):
63 self.name = name
64 self.pivot = pivot
65 self.table = table
66 self.count = count
67 self.tableStyleElement = tableStyleElement
70class TableStyleList(Serialisable):
72 tagname = "tableStyles"
74 defaultTableStyle = String(allow_none=True)
75 defaultPivotStyle = String(allow_none=True)
76 tableStyle = Sequence(expected_type=TableStyle, allow_none=True)
78 __elements__ = ('tableStyle',)
79 __attrs__ = ("count", "defaultTableStyle", "defaultPivotStyle")
81 def __init__(self,
82 count=None,
83 defaultTableStyle="TableStyleMedium9",
84 defaultPivotStyle="PivotStyleLight16",
85 tableStyle=(),
86 ):
87 self.defaultTableStyle = defaultTableStyle
88 self.defaultPivotStyle = defaultPivotStyle
89 self.tableStyle = tableStyle
92 @property
93 def count(self):
94 return len(self.tableStyle)