Difference between revisions of "OpenDocument"

From Free Pascal wiki
Jump to navigationJump to search
(Removed Win NT "File names with spaces" workaround: this is no longer needed since Laz 1.0.8)
(Added See also section; fixed syntax highlighting)
Line 2: Line 2:
 
Unit: Lazarus '''lclintf'''
 
Unit: Lazarus '''lclintf'''
  
<syntaxhighlight>
+
<syntaxhighlight lang="pascal">
 
function OpenDocument(APath: String): Boolean;
 
function OpenDocument(APath: String): Boolean;
 
</syntaxhighlight>
 
</syntaxhighlight>
Line 12: Line 12:
  
 
==Example==
 
==Example==
<syntaxhighlight>
+
<syntaxhighlight lang="pascal">
 
uses  
 
uses  
 
...
 
...
Line 19: Line 19:
 
OpenDocument('readme.pdf');
 
OpenDocument('readme.pdf');
 
</syntaxhighlight>
 
</syntaxhighlight>
 +
 +
== See also ==
 +
 +
* [[macOS_Open_Sesame|macOS Open command]]
 +
* [[openurl|OpenURL]]
 +
 
[[category:Lazarus]]
 
[[category:Lazarus]]
 
[[category:lclintf]]
 
[[category:lclintf]]
 
[[Category:Inter-process communication]]
 
[[Category:Inter-process communication]]

Revision as of 08:10, 6 February 2020

Definition

Unit: Lazarus lclintf

function OpenDocument(APath: String): Boolean;

Official documentation: [1]

Description

opendocument opens a document/file with the default viewer/editor registered with the operating system for that file/file extension. E.g. on Windows, the code will use the registry to look up the file association for the extension.

Example

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

See also