OpenDocument

From Lazarus wiki
(Redirected from opendocument)
Jump to navigationJump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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 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 Windows, the code will use the registry to look up the file association for the extension. As with macOS, it will also open directories.

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

Example

uses 
  LCLIntf;
begin
  OpenDocument('readme.pdf');

See also