Skip to content

Purpose of setting empty string to cell in "nil" case #756

@ykartoev

Description

@ykartoev

Hi!

Explain please, what the purpose of setting the value "" to cell in SetCellValue method, when value argument is nil? I don't report is as a bug, because as I can see it's done deliberately, but I don't get a point of that.
Here is the line of code I'm talking about https://github.com/360EntSecGroup-Skylar/excelize/blob/master/cell.go#L96

The problem is that It fills the cell with some value, and excel doesn't take that kind cells as empty (you can check it by calling ISBLANK() excel function on them), so when you for example set row data by using SetSheetRow and want skip some cells in the row by passing a nil, it fills them with "", and so you not skipping them in fact, only setting to empty string.

So what the point of that line of code? Can you just skip the case of value == nil in SetCellValue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions