xlsxwriter.lua
xlsxwriter.lua copied to clipboard
Feature request: Some suggestions to API
- Inherite Formats
Base = w:add_format{...}
Derive = Base:derive{...}
-- if we change value in `Base` value also changes in `Derive`
-- If we set value in `Derive` then all changes in `Base` are ignore.
- Clone Formats
Base = w:add_format{...}
Derive = Base:clone{...} -- independent
-
set
method
format:set{align = 'center'}
- functions should return
self
format
:set_align(...)
:set_color(...)
sheet
:write(...)
:write(...)
Hi, I agree with the above suggestions. Deriving is a good idea, however I think it may produce some problems. Clone - method known from another libraries (wx) - for sure it will be safer. Lack of get() of existing cell format now makes using library uncomfortable. Same for modifying value of already formatted cells. Also, why there is no parameter, e. in set_bold() ? In my document I format big range of cells (color and border), and later only for some of them bold style is set. No way to modify, I have to create a new format.
I can make improvements, I only need to know how to test it (modify/create new tests?).
One more: is there some compatibility with Python implementation intended? I mean the API should be the same or we can implement new features freely ?
Also, why there is no parameter, e. in set_bold() ? In my document I format big range of cells (color and border), and later only for some of them bold style is set. No way to modify, I have to create a new format.
Seems reasonable. You should submit a separate issue for that.
is there some compatibility with Python implementation intended?
Yes. The API should mirror the Perl/Python APIs.
So (for example) if in Perl implementation there is no parameter in set_bold(), it shouldn't appear in Lua as well, even if this is reasonable thing to do ?
Now I checked: Python version supports input argument in set_bold(), beside that the True
is the default
Now I checked: Python version supports input argument in set_bold(), beside that the True is the default
Right. So if it isn't in the lua version then it is probably a bug (or oversight). So If you open an issue, I'll fix it (and for the other properties as well).