diff options
| author | Randy Morgan <[email protected]> | 2013-09-30 09:53:29 +0900 |
|---|---|---|
| committer | Randy Morgan <[email protected]> | 2013-09-30 09:53:29 +0900 |
| commit | 3a174bc69ac213939565da20e14eeb9e18d5413f (patch) | |
| tree | d61f6df7c40e498dd052ead6af9e992d11ce2ac1 /lib | |
| parent | 09c9170e50ed4550015e34fdb54b7433bee0ef40 (diff) | |
| download | caxlsx-3a174bc69ac213939565da20e14eeb9e18d5413f.tar.gz caxlsx-3a174bc69ac213939565da20e14eeb9e18d5413f.zip | |
add name attribute to cell to create defined names for a single cell. https://github.com/randym/axlsx/issues/241
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/axlsx/workbook/worksheet/cell.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/axlsx/workbook/worksheet/cell.rb b/lib/axlsx/workbook/worksheet/cell.rb index e83e456a..6e3512c5 100644 --- a/lib/axlsx/workbook/worksheet/cell.rb +++ b/lib/axlsx/workbook/worksheet/cell.rb @@ -326,6 +326,18 @@ module Axlsx absolute ? r_abs : r end + + # Creates a defined name in the workbook for this cell. + def name=(label) + row.worksheet.workbook.add_defined_name "#{row.worksheet.name}!#{r_abs}", name: label + @name = label + end + + # returns the name of the cell + def name + @name + end + private # we scale the font size if bold style is applied to either the style font or |
