Skip to content

Commit

Permalink
Document CellRef (#257)
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanrboyer committed Apr 11, 2024
1 parent 6c6dc71 commit e80dba0
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions src/types.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,37 @@ struct CellPosition
column::Int
end

#=
"""
CellRef(n::AbstractString)
CellRef(row::Int, col::Int)
A `CellRef` represents a cell location given by row and column identifiers.
`CellRef("A6")` indicates a cell located at column `1` and row `6`.
`CellRef("B6")` indicates a cell located at column `2` and row `6`.
Example:
These row and column integers can also be passed directly to the `CellRef` constructor: `CellRef(6,2) == CellRef("B6")`.
Finally, a convenience macro `@ref_str` is provided: `ref"B6" == CellRef("B6")`.
# Examples
```julia
cn = XLSX.CellRef("AB1")
println( XLSX.row_number(cn) ) # will print 1
println( XLSX.column_number(cn) ) # will print 28
println( string(cn) ) # will print out AB1
```
As a convenience, `@ref_str` macro is provided.
cn = XLSX.CellRef(1, 28)
println( XLSX.row_number(cn) ) # will print 1
println( XLSX.column_number(cn) ) # will print 28
println( string(cn) ) # will print out AB1
```julia
cn = XLSX.ref"AB1"
println( XLSX.row_number(cn) ) # will print 1
println( XLSX.column_number(cn) ) # will print 28
println( string(cn) ) # will print out AB1
```
=#
"""
struct CellRef
name::String
row_number::Int
Expand Down

0 comments on commit e80dba0

Please sign in to comment.