@@ -1468,37 +1468,6 @@ def write_cells(self, cells, sheet_name=None, startrow=0, startcol=0,
1468
1468
startcol + cell .col ,
1469
1469
val , style )
1470
1470
1471
- @classmethod
1472
- def _tweak_style (cls , item ):
1473
- item = item .copy ()
1474
- for k in ['top' , 'right' , 'bottom' , 'left' ]:
1475
- if k not in item :
1476
- continue
1477
- side = item [k ]
1478
- if not hasattr (side , 'items' ):
1479
- continue
1480
- color = side .get ('color' ) or side .get ('colour' )
1481
- if color is not None :
1482
- item [k + '_color' ] = color
1483
- if side .get ('style' ):
1484
- item [k ] = side ['style' ]
1485
- if 'fill' in item and 'pattern' not in item :
1486
- fill = item .pop ('fill' )
1487
- item ['pattern' ] = {}
1488
- for k in ['patternType' , 'patterntype' , 'fill_type' ]:
1489
- if k in fill :
1490
- item ['pattern' ]['pattern' ] = fill [k ]
1491
- break
1492
- for k in ['fgColor' , 'fgcolor' , 'start_color' ]:
1493
- if k in fill :
1494
- item ['pattern' ]['fore_color' ] = fill [k ]
1495
- break
1496
- for k in ['bgColor' , 'bgcolor' , 'end_color' ]:
1497
- if k in fill :
1498
- item ['pattern' ]['back_color' ] = fill [k ]
1499
- break
1500
- return item
1501
-
1502
1471
@classmethod
1503
1472
def _style_to_xlwt (cls , item , firstlevel = True , field_sep = ',' ,
1504
1473
line_sep = ';' ):
@@ -1507,19 +1476,16 @@ def _style_to_xlwt(cls, item, firstlevel=True, field_sep=',',
1507
1476
1508
1477
hstyle = {"font": {"bold": True},
1509
1478
"border": {"top": "thin",
1510
- "right": {"style": " thin", "color": "red"} ,
1479
+ "right": " thin",
1511
1480
"bottom": "thin",
1512
1481
"left": "thin"},
1513
1482
"align": {"horiz": "center"}}
1514
1483
will be converted to
1515
1484
font: bold on; \
1516
- border: top thin, right thin, right_color red, \
1517
- bottom thin, left thin; \
1485
+ border: top thin, right thin, bottom thin, left thin; \
1518
1486
align: horiz center;
1519
1487
"""
1520
1488
if hasattr (item , 'items' ):
1521
- item = cls ._tweak_style (item )
1522
-
1523
1489
if firstlevel :
1524
1490
it = ["%s: %s" % (key , cls ._style_to_xlwt (value , False ))
1525
1491
for key , value in item .items ()]
0 commit comments