reports.core: Add BaseODS.bgcolor_style() method.
This commit is contained in:
parent
087b3274e7
commit
91cbbc9159
1 changed files with 12 additions and 0 deletions
|
@ -896,6 +896,18 @@ class BaseODS(BaseSpreadsheet[RT, ST], metaclass=abc.ABCMeta):
|
||||||
|
|
||||||
### Styles
|
### Styles
|
||||||
|
|
||||||
|
def bgcolor_style(self, color: str) -> odf.style.Style:
|
||||||
|
key =f'BGColor{color.lstrip("#")}'
|
||||||
|
try:
|
||||||
|
retval = self._style_cache[key]
|
||||||
|
except KeyError:
|
||||||
|
props = odf.style.TableCellProperties(backgroundcolor=color)
|
||||||
|
retval = odf.style.Style(name=key, family='table-cell')
|
||||||
|
retval.addElement(props)
|
||||||
|
self.document.styles.addElement(retval)
|
||||||
|
self._style_cache[key] = retval
|
||||||
|
return retval
|
||||||
|
|
||||||
def border_style(self,
|
def border_style(self,
|
||||||
edges: int,
|
edges: int,
|
||||||
width: str='1px',
|
width: str='1px',
|
||||||
|
|
Loading…
Reference in a new issue