| Summary: | No documentation about proper conversion of system file names into URLs in Calc | ||
|---|---|---|---|
| Product: | LibreOffice | Reporter: | Mike Kaganski <mikekaganski> |
| Component: | Documentation | Assignee: | Not Assigned <libreoffice-bugs> |
| Status: | NEW --- | ||
| Severity: | normal | CC: | erack, olivier.hallot |
| Priority: | medium | ||
| Version: | unspecified | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | |||
| Crash report or crash signature: | Regression By: | ||
There is HYPERLINK function in Calc, that is documented [1] [2] to take URL/IRI. There's also ENCODEURL [3] to properly URL-encode various strings. Yet, the latter function is not enough to convert random system filepath into proper file: URL on all platforms. E.g., on Windows, the conversion also includes replacing backslashes '\' with forward-slashes '/'. A naive attempt to concatenate "file://" with "c:\path to\file.ext" would result in invalid URL; also concatenating "file://" with ENCODEURL("c:\path to\file.ext") is not correct. But in fact, LibreOffice does the magic of proper conversion of system filepaths into URLs: clicking on a cell with > =HYPERLINK("c:\path to\file.ext") would result in attempt to open proper "file:///c:/path%20to/file.ext". The magic happens in ScGlobal::OpenURL calling ScGlobal::GetAbsDocName. I suppose it's worth mentioning that on HYPERLINK help page, to avoid users trying to create file URLs in various wrong ways. Refs: https://ask.libreoffice.org/en/question/255719/, https://ask.libreoffice.org/en/question/142052/ [1] https://help.libreoffice.org/6.4/en-US/text/scalc/01/04060109.html?DbPAR=CALC#bm_id9959410 [2] docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part2.html#__RefHeading__1018226_715980110 [3] https://help.libreoffice.org/6.4/en-US/text/scalc/01/func_webservice.html?DbPAR=CALC#bm_id811517136840444