Difference between revisions of "Creating a document"

From Apache OpenOffice Wiki
Jump to: navigation, search
m
 
Line 1: Line 1:
 
The following function creates a new document of the specified type in a new window.
 
The following function creates a new document of the specified type in a new window.
  
<source lang="oobas">
+
<syntaxhighlight lang="oobas">
 
function fnNewDoc(sDocType as string)
 
function fnNewDoc(sDocType as string)
 
fnNewDoc = StarDesktop.loadComponentFromURL("private:factory/" & sDocType , "_blank", 0, Array())
 
fnNewDoc = StarDesktop.loadComponentFromURL("private:factory/" & sDocType , "_blank", 0, Array())
 
end function
 
end function
</source>
+
</syntaxhighlight>
  
 
Examples of calling this function:  
 
Examples of calling this function:  
  
<source lang="oobas">
+
<syntaxhighlight lang="oobas">
 
oDoc = fnNewDoc("swriter")
 
oDoc = fnNewDoc("swriter")
 
oDoc = fnNewDoc("scalc")
 
oDoc = fnNewDoc("scalc")
Line 15: Line 15:
 
oDoc = fnNewDoc("sdraw")
 
oDoc = fnNewDoc("sdraw")
 
oDoc = fnNewDoc("smath")
 
oDoc = fnNewDoc("smath")
</source>
+
</syntaxhighlight>
  
 
[[Category:Basic:Tutorials]]
 
[[Category:Basic:Tutorials]]

Latest revision as of 14:40, 24 August 2022

The following function creates a new document of the specified type in a new window.

function fnNewDoc(sDocType as string)
fnNewDoc = StarDesktop.loadComponentFromURL("private:factory/" & sDocType , "_blank", 0, Array())
end function

Examples of calling this function:

oDoc = fnNewDoc("swriter")
oDoc = fnNewDoc("scalc")
oDoc = fnNewDoc("simpress")
oDoc = fnNewDoc("sdraw")
oDoc = fnNewDoc("smath")
Personal tools