From 3a174bc69ac213939565da20e14eeb9e18d5413f Mon Sep 17 00:00:00 2001 From: Randy Morgan Date: Mon, 30 Sep 2013 09:53:29 +0900 Subject: add name attribute to cell to create defined names for a single cell. https://github.com/randym/axlsx/issues/241 --- lib/axlsx/workbook/worksheet/cell.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lib') 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 -- cgit v1.2.3