spreadsheet-xlsx
spreadsheet-xlsx copied to clipboard
Getting value of empty cell dies
Calling .value
on a empty cell dies with
Method 'sync-value-xml' must be implemented by Spreadsheet::XLSX::Cell because it is required by roles: Spreadsheet::XLSX::Cell.
Repro:
use Spreadsheet::XLSX;
my $work-book = Spreadsheet::XLSX.new;
my $work-sheet = $workbook.create-worksheet('Test');
my $value = $work-sheet.cells[0;0].value;
I have tried to set a empty value to cells, it also can't work. It says must set a ( int row, int col , string or number ) to cell.So I write a subroutine to judge a variable is defined or not , then set a defined value to cell.
@vrurg Does your latest improvements perhaps fix this?
@jnthn Actually, no. The EmptyCell
is returned for when there is a cell but it has no value. Whereas this particular case is about 'no cell exists' situation. For which returning an undefined value is what I would expect it to be.
To make an example from spreadsheet world, clicking a cell doesn't autovivify it. But storing and deleting something does.
BTW, it is now possible to do $work-sheet.cells[0;0]:exists
.
It just crossed my mind that returning Nil
would make more sense than returning Cell
type object.