Open mavaras opened 4 years ago
Do you have some sample code to reproduce the issue? This functionality should be working, we have test cases covering it too.
Here is my Style. The only thing not working is format.
style = Style(
size=width,
alignment=Alignment(wrap_text=True),
format=Format('mm/dd/yy') # '0.00%' with same behaviour
)
And then applying this to a column:
current_sheet.set_col_style(
column + 1,
style,
)
I've also checked your unittests but not found tests about that Format.
Ok, I'll take a look, that's a bit odd.
I took a first pass at this, the style is being populated correctly. For some reason, there's a subtlety in what Excel picks up as a valid reference to the format style. I wasn't able to figure out exactly what was wrong though. That being said, individual cells do format correctly, so
ws[x][y].style.format.format = '0.00%'
should work. It's not quite as nice as formatting the entire column at once, but at least the specific cells can be formatted. I have a hunch that Excel itself may not allow formatting columns and instead actually formats the individual cells too.
If you do figure out what's wrong with PyExcelerate here though, we'd appreciate a pull request. I don't have much bandwidth at the moment so it'll be a while before I can get back to this.
Having this same issue as well. It looks like ranges and columns also need a special exception in the __get_attr function of Range. This is what's currently in place for rows: https://github.com/kz26/PyExcelerate/blob/5791158aa14a773823cf025c245e307effbf66d6/pyexcelerate/Range.py#L165
The error is caused by entering the else statement of this code block and calling len() on the passed Style object.
Hello, first of all thanks for giving us a great-superfast solution for generate XLS files.
My issue is about that Formats are not working. I've tried several ones with no success, producing no field changes. I specially want to apply the Percentage one (0.00%), but I've also tried the date one as you show in the README and nothing happens (mm/dd/yy).
I don't know if this is a task in progress or simply a bug.
Thanks in advance.