You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I see that sheet["A1"] = "" is necessary because sheet["A1"] can return an EmptyCell which has no fields.
I also see that there is the AbstractFormula type (which isn't yet being used in the Cell type in v0.9.0). Is this going to be used in future versions? If so, I can imagine an interface that looks like this:
abstract type AbstractFormula endformula(f::AbstractFormula) = f.formula
struct FormulaA1 <:AbstractFormula
formula::Stringend
Base.convert(::Type{FormulaA1}, v::FormulaA1) = v
function Base.convert(::Type{FormulaR1C1}, v::FormulaA1)
# convert A1 to R1C1endstruct FormulaR1C1 <:AbstractFormula
formula::Stringendfunction Base.convert(::Type{FormulaA1}, v::FormulaR1C1)
# convert R1C1 to A1end
Base.convert(::Type{FormulaR1C1}, v::FormulaR1C1) = v
functionsetformula!(ws::XLSX.Worksheet, ref::XLSX.CellRef, v::AbstractFormula)
f =formula(convert(::FormulaA1, v))
cell = XLSX.getcell(ws, ref)
if cell isa XLSX.EmptyCell
cell = XLSX.Cell(ref, "", "", "", f)
XLSX.setdata!(ws, cell)
else
cell.formula = f
endreturn cell
end
I'm not yet too familiar with internals of this package, but with some direction I'd be willing to prototype this out and open a PR. Let me know what you think, and thanks for this package!
The text was updated successfully, but these errors were encountered:
I'd like to propose a simplified way to setting a cell formula. I see that in #120 the proposed way to set a cell formula is to do
I see that
sheet["A1"] = ""
is necessary becausesheet["A1"]
can return anEmptyCell
which has no fields.I also see that there is the
AbstractFormula
type (which isn't yet being used in theCell
type in v0.9.0). Is this going to be used in future versions? If so, I can imagine an interface that looks like this:I'm not yet too familiar with internals of this package, but with some direction I'd be willing to prototype this out and open a PR. Let me know what you think, and thanks for this package!
The text was updated successfully, but these errors were encountered: