weshatheleopard / rubyXL

Ruby lib for reading/writing/modifying .xlsx and .xlsm files
MIT License
1.28k stars 255 forks source link

FR (?): Set cell padding #348

Closed sixtyfive closed 2 years ago

sixtyfive commented 5 years ago

Is there any way (or if not, would it be feasible to implement such a thing?) to set a cell's top/bottom/lef/right padding in millimeters like can be done from within Excel or Calc (right mouse button on cell(s) > "Format cell" > "Borders" > "Padding")? For example worksheet.get_padding(side = nil) and worksheet.change_padding(row, col, side = nil), where a side of nil would mean "all sides at once")...

weshatheleopard commented 2 years ago

When I right-click on a cell, I can do Format Cells > Border, but there's no "padding" option on that dialog. So I'm not sure what this request is about.

sixtyfive commented 2 years ago

image

weshatheleopard commented 2 years ago

I have no idea where did this picture come from. Here's the dialog that I have:

image

What you can do is open a blank workbook, set padding in any single cell and send that workbook to me so I can investigate.

sixtyfive commented 2 years ago

Interesting, That picture came from LibreOffice Calc. I didn't think that it would have any features that Microsoft Excel doesn't have. But doing what you asked and then saving as .xlsx, closing, and opening the document again causes the padding to be lost. Setting the padding, daving as .ods, closing, and opening the document again causes it to be retained. The I have my answer. Thank you, Wesha!

weshatheleopard commented 2 years ago

It feels like cell padding is not supported in the SpreadsheetML specification, so it cannot be supported by rubyXL. If I'm wrong, feel free to correct me.

sixtyfive commented 2 years ago

I agree.