weshatheleopard / rubyXL

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

cell and styles.xml #436

Closed daniel-just closed 1 year ago

daniel-just commented 1 year ago

Hi,

I try to copy format from one cell to another cell. But the excel template is using styles in xl/styles.xml

How can I read this from my cell and use it for the other cell?

Additionaly: Excel is giving me a warning when open the generated excelfile:

Excel hat die Überprüfung und Reparatur auf Dateiebene abgeschlossen. Einige Teile dieser Arbeitsmappe wurden repariert oder verworfen. Reparierte Datensätze: Formatierung von /xl/styles.xml-Part (Formatvorlagen)

How can I prevent this? I use this in my code worksheet.sheet_format_pr = Marshal.load(Marshal.dump(template.sheet_format_pr))

weshatheleopard commented 1 year ago
  1. Please remember that THIS is not a forum for questions "how to use this"; if you are using this library, you must be a software developer; and software developers are expected to be capable of reading the code and learning how it can be used. This is the place to report bugs that require the maintainer's attention.
  2. To exactly copy all the formatting and styles from one cell to another, you need to set the destination cell's style_index to that of the source cell.
  3. RubyXL is not designed to be a perfect replica of Excel, as it would take immense effort to replicate every single feature. RubyXL is mostly geared to reading data from xlsx spreadsheets, and the capability to modify them is a free bonus ontop of that. Naturally, it doesn't always work perfectly. Namely, unlike Excel, RubyXL does not track all the interdependenices in the spereadsheet data structure, of which there are way too many. It's a full time job for multiple people, and I'm alone using my free time.