Sign in Join
Wiki copytemporary

OpenDocument: what changed

Revision 2 to 3. Removed lines have a minus sign; added lines have a plus sign.

Title: opendocument OpenDocument

OldNewLine
1-#REDIRECT [[OpenDocument]]
1+## Definition
2+
3+Unit: Lazarus **lclintf**
4+
5+``` pascal
6+function OpenDocument(APath: String): Boolean;
7+```
8+
9+Official documentation: [OpenDocument](http://lazarus-ccr.sourceforge.net/docs/lcl/lclintf/opendocument.html)
10+
11+## Description
12+
13+`OpenDocument` opens a document/file with the default viewer/editor registered with the operating system for that file/file extension.
14+
15+- On macOS, the code calls the [[macOS Open Sesame|open]] command line utility for files **and** directories. This will open the default application for the file or directory as determined by LaunchServices.
16+- On Windows, the code will use the registry to look up the file association for the extension. As with macOS, it will also open directories.
17+
18+On both macOS and Windows, `OpenDocument` will also open a URL using the default web browser.
19+
20+## Example
21+
22+``` pascal
23+uses
24+ LCLIntf;
25+begin
26+ OpenDocument('readme.pdf');
27+```
28+
29+## See also
30+
31+- [[macOS Open Sesame|macOS Open command]]
32+- [[OpenURL]]
33+
34+---
35+*From the Free Pascal wiki, page "OpenDocument", as it stood on 2021-11-28 after a change by Alextp, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*
36+Category: Inter-process communication
37+Category: Lazarus
38+Category: lclintf

Back to history