xlsxwriter.lua icon indicating copy to clipboard operation
xlsxwriter.lua copied to clipboard

Feature request: Some suggestions to API

Open moteus opened this issue 10 years ago • 6 comments

  1. 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.
  1. Clone Formats
Base = w:add_format{...}
Derive = Base:clone{...} -- independent
  1. set method
format:set{align = 'center'}
  1. functions should return self
format
  :set_align(...)
  :set_color(...)

sheet
  :write(...)
  :write(...)

moteus avatar Jan 21 '15 14:01 moteus

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?).

marmidr avatar Jun 13 '16 10:06 marmidr

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 ?

marmidr avatar Jun 13 '16 10:06 marmidr

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.

jmcnamara avatar Jun 13 '16 11:06 jmcnamara

is there some compatibility with Python implementation intended?

Yes. The API should mirror the Perl/Python APIs.

jmcnamara avatar Jun 13 '16 11:06 jmcnamara

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

marmidr avatar Jun 13 '16 11:06 marmidr

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).

jmcnamara avatar Jun 13 '16 12:06 jmcnamara