qrilka / xlsx

Simple and incomplete Excel file parser/writer
MIT License
128 stars 62 forks source link

Hyperlink Support #141

Open Microtribute opened 2 years ago

Microtribute commented 2 years ago

Is it possible to make a cell a hyperlink either to an external link or to a worksheet in the same document?

qrilka commented 2 years ago

Hi @Microtribute Sorry for a late reply - was away on my vacation. Could you show me an example workbook so I could check out the details?

GulinSS commented 3 months ago

@Microtribute try workaround via formula. Something like:

let
  full_url = ...
  full_formula = Xlsx.NormalFormula . Xlsx.Formula
    $ "HYPERLINK(\"" <> full_url <> "\", \"" <> cell_text <> "\")"
in Xlsx.def { Xlsx._cellFormula = Just $ Xlsx.CellFormula full_formula False False }

It was adapted from here.

qrilka commented 3 months ago

If this workaround works then what would you imagine as "proper" relplacement as a part of the library API?

GulinSS commented 3 months ago

Probably something like in Python

qrilka commented 3 months ago

Python is a bit different from Haskell but I'm OK with adding some helper if you will create a PR. And yet I don't understand if you want something different to the workaround above.

GulinSS commented 3 months ago

As for now the workaround via formula was more than enough for me. I've added it here just for somebody who will come to here via google search + github search.

qrilka commented 3 months ago

PR with this as a helper is welcome