Difference between revisions of "OpenDocument"

From Free Pascal wiki
Jump to navigationJump to search
(→‎Description: Expanded description)
m (Bypass openurl redirection to OpenUrl)
Line 32: Line 32:
  
 
* [[macOS_Open_Sesame|macOS Open command]]
 
* [[macOS_Open_Sesame|macOS Open command]]
* [[openurl|OpenURL]]
+
* [[OpenURL]]
  
 
[[category:Lazarus]]
 
[[category:Lazarus]]
 
[[category:lclintf]]
 
[[category:lclintf]]
 
[[Category:Inter-process communication]]
 
[[Category:Inter-process communication]]

Revision as of 05:07, 1 April 2021

English (en) 中文(中国大陆)‎ (zh_CN)

Definition

Unit: Lazarus lclintf

function OpenDocument(APath: String): Boolean;

Official documentation: OpenDocument

Description

OpenDocument opens a document/file with the default viewer/editor registered with the operating system for that file/file extension.

  • On Windows, the code will use the registry to look up the file association for the extension.
  • On macOS, the code calls the open command line utility for files and directories. This will open the default application for the file or directory as determined by LaunchServices.

On both Windows and macOS, OpenDocument will also open a URL using the default web browser.

Example

uses 
...
lclintf
...
OpenDocument('readme.pdf');

See also