<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.autoitscript.com/w/index.php?action=history&amp;feed=atom&amp;title=LibreOffice-Examples</id>
	<title>LibreOffice-Examples - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://www.autoitscript.com/w/index.php?action=history&amp;feed=atom&amp;title=LibreOffice-Examples"/>
	<link rel="alternate" type="text/html" href="https://www.autoitscript.com/w/index.php?title=LibreOffice-Examples&amp;action=history"/>
	<updated>2026-04-12T09:45:42Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.6</generator>
	<entry>
		<id>https://www.autoitscript.com/w/index.php?title=LibreOffice-Examples&amp;diff=15260&amp;oldid=prev</id>
		<title>Water: Created page with &quot;==Getting Started Examples== ===Quickstart: Base===  &lt;syntaxhighlight lang=&quot;autoit&quot;&gt; #include &lt;MsgBoxConstants.au3&gt; #include &lt;File.au3&gt;  #include &quot;LibreOfficeBase.au3&quot;  ; Create a New, visible, Blank Libre Office Document. Global $oDoc = _LOBase_DocCreate(True, False) If @error Then Exit MsgBox($MB_OK + $MB_ICONERROR + $MB_TOPMOST, &quot;Error&quot;, &quot;Failed to Create a new Base Document. Error:&quot; &amp; @error &amp; &quot; Extended:&quot; &amp; @extended &amp; &quot; On Line: &quot; &amp; @ScriptLineNumber)  ; Set the Da...&quot;</title>
		<link rel="alternate" type="text/html" href="https://www.autoitscript.com/w/index.php?title=LibreOffice-Examples&amp;diff=15260&amp;oldid=prev"/>
		<updated>2026-02-23T15:52:27Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;==Getting Started Examples== ===Quickstart: Base===  &amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt; #include &amp;lt;MsgBoxConstants.au3&amp;gt; #include &amp;lt;File.au3&amp;gt;  #include &amp;quot;LibreOfficeBase.au3&amp;quot;  ; Create a New, visible, Blank Libre Office Document. Global $oDoc = _LOBase_DocCreate(True, False) If @error Then Exit MsgBox($MB_OK + $MB_ICONERROR + $MB_TOPMOST, &amp;quot;Error&amp;quot;, &amp;quot;Failed to Create a new Base Document. Error:&amp;quot; &amp;amp; @error &amp;amp; &amp;quot; Extended:&amp;quot; &amp;amp; @extended &amp;amp; &amp;quot; On Line: &amp;quot; &amp;amp; @ScriptLineNumber)  ; Set the Da...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==Getting Started Examples==&lt;br /&gt;
===Quickstart: Base===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;MsgBoxConstants.au3&amp;gt;&lt;br /&gt;
#include &amp;lt;File.au3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;LibreOfficeBase.au3&amp;quot;&lt;br /&gt;
&lt;br /&gt;
; Create a New, visible, Blank Libre Office Document.&lt;br /&gt;
Global $oDoc = _LOBase_DocCreate(True, False)&lt;br /&gt;
If @error Then Exit MsgBox($MB_OK + $MB_ICONERROR + $MB_TOPMOST, &amp;quot;Error&amp;quot;, &amp;quot;Failed to Create a new Base Document. Error:&amp;quot; &amp;amp; @error &amp;amp; &amp;quot; Extended:&amp;quot; &amp;amp; @extended &amp;amp; &amp;quot; On Line: &amp;quot; &amp;amp; @ScriptLineNumber)&lt;br /&gt;
&lt;br /&gt;
; Set the Database type.&lt;br /&gt;
_LOBase_DocDatabaseType($oDoc)&lt;br /&gt;
If @error Then Exit MsgBox($MB_OK + $MB_ICONERROR + $MB_TOPMOST, &amp;quot;Error&amp;quot;, &amp;quot;Failed to Set Base Document Database type. Error:&amp;quot; &amp;amp; @error &amp;amp; &amp;quot; Extended:&amp;quot; &amp;amp; @extended &amp;amp; &amp;quot; On Line: &amp;quot; &amp;amp; @ScriptLineNumber)&lt;br /&gt;
&lt;br /&gt;
; Create a unique file name&lt;br /&gt;
Global $sSavePath = _TempFile(@DesktopDir &amp;amp; &amp;quot;\&amp;quot;, &amp;quot;BaseDocTestFile_&amp;quot;, &amp;quot;.odb&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
; Save The Base Document To Desktop Directory.&lt;br /&gt;
_LOBase_DocSaveAs($oDoc, $sSavePath)&lt;br /&gt;
If @error Then Exit MsgBox($MB_OK + $MB_ICONERROR + $MB_TOPMOST, &amp;quot;Error&amp;quot;, &amp;quot;Failed to save the Base Document. Error:&amp;quot; &amp;amp; @error &amp;amp; &amp;quot; Extended:&amp;quot; &amp;amp; @extended &amp;amp; &amp;quot; On Line: &amp;quot; &amp;amp; @ScriptLineNumber)&lt;br /&gt;
&lt;br /&gt;
; Retrieve the Database Object.&lt;br /&gt;
$oDBase = _LOBase_DatabaseGetObjByDoc($oDoc)&lt;br /&gt;
If @error Then Exit MsgBox($MB_OK + $MB_ICONERROR + $MB_TOPMOST, &amp;quot;Error&amp;quot;, &amp;quot;Failed to Retrieve the Base Document Database Object. Error:&amp;quot; &amp;amp; @error &amp;amp; &amp;quot; Extended:&amp;quot; &amp;amp; @extended &amp;amp; &amp;quot; On Line: &amp;quot; &amp;amp; @ScriptLineNumber)&lt;br /&gt;
&lt;br /&gt;
; Connect to the Database&lt;br /&gt;
$oConnection = _LOBase_DatabaseConnectionGet($oDBase)&lt;br /&gt;
If @error Then Exit MsgBox($MB_OK + $MB_ICONERROR + $MB_TOPMOST, &amp;quot;Error&amp;quot;, &amp;quot;Failed to create a connection to the Database. Error:&amp;quot; &amp;amp; @error &amp;amp; &amp;quot; Extended:&amp;quot; &amp;amp; @extended &amp;amp; &amp;quot; On Line: &amp;quot; &amp;amp; @ScriptLineNumber)&lt;br /&gt;
&lt;br /&gt;
; Add a Table to the Database.&lt;br /&gt;
_LOBase_TableAdd($oConnection, &amp;quot;tblNew_Table&amp;quot;, &amp;quot;Col1&amp;quot;)&lt;br /&gt;
If @error Then Exit MsgBox($MB_OK + $MB_ICONERROR + $MB_TOPMOST, &amp;quot;Error&amp;quot;, &amp;quot;Failed to add a table to the Database. Error:&amp;quot; &amp;amp; @error &amp;amp; &amp;quot; Extended:&amp;quot; &amp;amp; @extended &amp;amp; &amp;quot; On Line: &amp;quot; &amp;amp; @ScriptLineNumber)&lt;br /&gt;
&lt;br /&gt;
; Close the connection.&lt;br /&gt;
_LOBase_DatabaseConnectionClose($oConnection)&lt;br /&gt;
If @error Then Exit MsgBox($MB_OK + $MB_ICONERROR + $MB_TOPMOST, &amp;quot;Error&amp;quot;, &amp;quot;Failed to close a connection to the Database. Error:&amp;quot; &amp;amp; @error &amp;amp; &amp;quot; Extended:&amp;quot; &amp;amp; @extended &amp;amp; &amp;quot; On Line: &amp;quot; &amp;amp; @ScriptLineNumber)&lt;br /&gt;
&lt;br /&gt;
; Save the changes to the document.&lt;br /&gt;
_LOBase_DocSave($oDoc)&lt;br /&gt;
If @error Then Exit MsgBox($MB_OK + $MB_ICONERROR + $MB_TOPMOST, &amp;quot;Error&amp;quot;, &amp;quot;Failed to Save the Base Document. Error:&amp;quot; &amp;amp; @error &amp;amp; &amp;quot; Extended:&amp;quot; &amp;amp; @extended &amp;amp; &amp;quot; On Line: &amp;quot; &amp;amp; @ScriptLineNumber)&lt;br /&gt;
&lt;br /&gt;
; Close the Base Document.&lt;br /&gt;
_LOBase_DocClose($oDoc, False)&lt;br /&gt;
If @error Then Exit MsgBox($MB_OK + $MB_ICONERROR + $MB_TOPMOST, &amp;quot;Error&amp;quot;, &amp;quot;Failed to Close the Base Document. Error:&amp;quot; &amp;amp; @error &amp;amp; &amp;quot; Extended:&amp;quot; &amp;amp; @extended &amp;amp; &amp;quot; On Line: &amp;quot; &amp;amp; @ScriptLineNumber)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Quickstart: Calc===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;MsgBoxConstants.au3&amp;gt;&lt;br /&gt;
#include &amp;lt;File.au3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;LibreOfficeCalc.au3&amp;quot;&lt;br /&gt;
&lt;br /&gt;
; Create a New, visible, Blank Libre Office Document.&lt;br /&gt;
Global $oDoc = _LOCalc_DocCreate(True, False)&lt;br /&gt;
If @error Then Exit MsgBox($MB_OK + $MB_ICONERROR + $MB_TOPMOST, &amp;quot;Error&amp;quot;, &amp;quot;Failed to Create a new Calc Document. Error:&amp;quot; &amp;amp; @error &amp;amp; &amp;quot; Extended:&amp;quot; &amp;amp; @extended &amp;amp; &amp;quot; On Line: &amp;quot; &amp;amp; @ScriptLineNumber)&lt;br /&gt;
&lt;br /&gt;
; Retrieve the presently active Sheet.&lt;br /&gt;
Global $oSheet = _LOCalc_SheetGetActive($oDoc)&lt;br /&gt;
If @error Then Exit MsgBox($MB_OK + $MB_ICONERROR + $MB_TOPMOST, &amp;quot;Error&amp;quot;, &amp;quot;Failed to retrieve the currently active Sheet Object. Error:&amp;quot; &amp;amp; @error &amp;amp; &amp;quot; Extended:&amp;quot; &amp;amp; @extended &amp;amp; &amp;quot; On Line: &amp;quot; &amp;amp; @ScriptLineNumber)&lt;br /&gt;
&lt;br /&gt;
; Retrieve the Object for Cell B1.&lt;br /&gt;
Global $oCell = _LOCalc_RangeGetCellByName($oSheet, &amp;quot;B1&amp;quot;)&lt;br /&gt;
If @error Then Exit MsgBox($MB_OK + $MB_ICONERROR + $MB_TOPMOST, &amp;quot;Error&amp;quot;, &amp;quot;Failed to retrieve B1 Cell Object. Error:&amp;quot; &amp;amp; @error &amp;amp; &amp;quot; Extended:&amp;quot; &amp;amp; @extended &amp;amp; &amp;quot; On Line: &amp;quot; &amp;amp; @ScriptLineNumber)&lt;br /&gt;
&lt;br /&gt;
; Set Cell B1&amp;#039;s Text.&lt;br /&gt;
_LOCalc_CellString($oCell, &amp;quot;Sales&amp;quot;)&lt;br /&gt;
If @error Then Exit MsgBox($MB_OK + $MB_ICONERROR + $MB_TOPMOST, &amp;quot;Error&amp;quot;, &amp;quot;Failed to Set B1 Cell content. Error:&amp;quot; &amp;amp; @error &amp;amp; &amp;quot; Extended:&amp;quot; &amp;amp; @extended &amp;amp; &amp;quot; On Line: &amp;quot; &amp;amp; @ScriptLineNumber)&lt;br /&gt;
&lt;br /&gt;
; Retrieve the Object for Cell B2.&lt;br /&gt;
$oCell = _LOCalc_RangeGetCellByName($oSheet, &amp;quot;B2&amp;quot;)&lt;br /&gt;
If @error Then Exit MsgBox($MB_OK + $MB_ICONERROR + $MB_TOPMOST, &amp;quot;Error&amp;quot;, &amp;quot;Failed to retrieve B2 Cell Object. Error:&amp;quot; &amp;amp; @error &amp;amp; &amp;quot; Extended:&amp;quot; &amp;amp; @extended &amp;amp; &amp;quot; On Line: &amp;quot; &amp;amp; @ScriptLineNumber)&lt;br /&gt;
&lt;br /&gt;
; Set B2 Cell Value to 50&lt;br /&gt;
_LOCalc_CellValue($oCell, 50)&lt;br /&gt;
If @error Then Exit MsgBox($MB_OK + $MB_ICONERROR + $MB_TOPMOST, &amp;quot;Error&amp;quot;, &amp;quot;Failed to Set B2 Cell content. Error:&amp;quot; &amp;amp; @error &amp;amp; &amp;quot; Extended:&amp;quot; &amp;amp; @extended &amp;amp; &amp;quot; On Line: &amp;quot; &amp;amp; @ScriptLineNumber)&lt;br /&gt;
&lt;br /&gt;
; Retrieve the Object for Cell B3.&lt;br /&gt;
$oCell = _LOCalc_RangeGetCellByName($oSheet, &amp;quot;B3&amp;quot;)&lt;br /&gt;
If @error Then Exit MsgBox($MB_OK + $MB_ICONERROR + $MB_TOPMOST, &amp;quot;Error&amp;quot;, &amp;quot;Failed to retrieve B3 Cell Object. Error:&amp;quot; &amp;amp; @error &amp;amp; &amp;quot; Extended:&amp;quot; &amp;amp; @extended &amp;amp; &amp;quot; On Line: &amp;quot; &amp;amp; @ScriptLineNumber)&lt;br /&gt;
&lt;br /&gt;
; Set B3 Cell Value to 15.50&lt;br /&gt;
_LOCalc_CellValue($oCell, 15.50)&lt;br /&gt;
If @error Then Exit MsgBox($MB_OK + $MB_ICONERROR + $MB_TOPMOST, &amp;quot;Error&amp;quot;, &amp;quot;Failed to Set B3 Cell content. Error:&amp;quot; &amp;amp; @error &amp;amp; &amp;quot; Extended:&amp;quot; &amp;amp; @extended &amp;amp; &amp;quot; On Line: &amp;quot; &amp;amp; @ScriptLineNumber)&lt;br /&gt;
&lt;br /&gt;
; Retrieve the Object for Cell A5.&lt;br /&gt;
$oCell = _LOCalc_RangeGetCellByName($oSheet, &amp;quot;A5&amp;quot;)&lt;br /&gt;
If @error Then Exit MsgBox($MB_OK + $MB_ICONERROR + $MB_TOPMOST, &amp;quot;Error&amp;quot;, &amp;quot;Failed to retrieve A5 Cell Object. Error:&amp;quot; &amp;amp; @error &amp;amp; &amp;quot; Extended:&amp;quot; &amp;amp; @extended &amp;amp; &amp;quot; On Line: &amp;quot; &amp;amp; @ScriptLineNumber)&lt;br /&gt;
&lt;br /&gt;
; Set Cell A5&amp;#039;s Text.&lt;br /&gt;
_LOCalc_CellString($oCell, &amp;quot;Total&amp;quot;)&lt;br /&gt;
If @error Then Exit MsgBox($MB_OK + $MB_ICONERROR + $MB_TOPMOST, &amp;quot;Error&amp;quot;, &amp;quot;Failed to Set B1 Cell content. Error:&amp;quot; &amp;amp; @error &amp;amp; &amp;quot; Extended:&amp;quot; &amp;amp; @extended &amp;amp; &amp;quot; On Line: &amp;quot; &amp;amp; @ScriptLineNumber)&lt;br /&gt;
&lt;br /&gt;
; Retrieve the Object for Cell B5.&lt;br /&gt;
$oCell = _LOCalc_RangeGetCellByName($oSheet, &amp;quot;B5&amp;quot;)&lt;br /&gt;
If @error Then Exit MsgBox($MB_OK + $MB_ICONERROR + $MB_TOPMOST, &amp;quot;Error&amp;quot;, &amp;quot;Failed to retrieve A5 Cell Object. Error:&amp;quot; &amp;amp; @error &amp;amp; &amp;quot; Extended:&amp;quot; &amp;amp; @extended &amp;amp; &amp;quot; On Line: &amp;quot; &amp;amp; @ScriptLineNumber)&lt;br /&gt;
&lt;br /&gt;
; Set the Formula for Cell B5&lt;br /&gt;
_LOCalc_CellFormula($oCell, &amp;quot;=SUM(B2:B3)&amp;quot;)&lt;br /&gt;
If @error Then Exit MsgBox($MB_OK + $MB_ICONERROR + $MB_TOPMOST, &amp;quot;Error&amp;quot;, &amp;quot;Failed to Set Cell B5 Formula. Error:&amp;quot; &amp;amp; @error &amp;amp; &amp;quot; Extended:&amp;quot; &amp;amp; @extended &amp;amp; &amp;quot; On Line: &amp;quot; &amp;amp; @ScriptLineNumber)&lt;br /&gt;
&lt;br /&gt;
; Create a unique file name&lt;br /&gt;
Global $sSavePath = _TempFile(@DesktopDir &amp;amp; &amp;quot;\&amp;quot;, &amp;quot;CalcDocTestFile_&amp;quot;, &amp;quot;.ods&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
; Save The Calc Document To Desktop Directory.&lt;br /&gt;
_LOCalc_DocSaveAs($oDoc, $sSavePath)&lt;br /&gt;
If @error Then Exit MsgBox($MB_OK + $MB_ICONERROR + $MB_TOPMOST, &amp;quot;Error&amp;quot;, &amp;quot;Failed to save the Calc Document. Error:&amp;quot; &amp;amp; @error &amp;amp; &amp;quot; Extended:&amp;quot; &amp;amp; @extended &amp;amp; &amp;quot; On Line: &amp;quot; &amp;amp; @ScriptLineNumber)&lt;br /&gt;
&lt;br /&gt;
; Close the Calc Document.&lt;br /&gt;
_LOCalc_DocClose($oDoc, False)&lt;br /&gt;
If @error Then Exit MsgBox($MB_OK + $MB_ICONERROR + $MB_TOPMOST, &amp;quot;Error&amp;quot;, &amp;quot;Failed to Close the Calc Document. Error:&amp;quot; &amp;amp; @error &amp;amp; &amp;quot; Extended:&amp;quot; &amp;amp; @extended &amp;amp; &amp;quot; On Line: &amp;quot; &amp;amp; @ScriptLineNumber)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Quickstart: Writer===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;MsgBoxConstants.au3&amp;gt;&lt;br /&gt;
#include &amp;lt;File.au3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;LibreOfficeWriter.au3&amp;quot;&lt;br /&gt;
&lt;br /&gt;
; Create a New, visible, Blank Libre Office Document.&lt;br /&gt;
Global $oDoc = _LOWriter_DocCreate(True, False)&lt;br /&gt;
If @error Then Exit MsgBox($MB_OK + $MB_ICONERROR + $MB_TOPMOST, &amp;quot;Error&amp;quot;, &amp;quot;Failed to Create a new Writer Document. Error:&amp;quot; &amp;amp; @error &amp;amp; &amp;quot; Extended:&amp;quot; &amp;amp; @extended &amp;amp; &amp;quot; On Line: &amp;quot; &amp;amp; @ScriptLineNumber)&lt;br /&gt;
&lt;br /&gt;
; Retrieve the visible document cursor (caret) to insert text with.&lt;br /&gt;
Global $oViewCursor = _LOWriter_DocGetViewCursor($oDoc)&lt;br /&gt;
If @error Then Exit MsgBox($MB_OK + $MB_ICONERROR + $MB_TOPMOST, &amp;quot;Error&amp;quot;, &amp;quot;Failed to retrieve the View Cursor Object for the Writer Document. Error:&amp;quot; &amp;amp; @error &amp;amp; &amp;quot; Extended:&amp;quot; &amp;amp; @extended &amp;amp; &amp;quot; On Line: &amp;quot; &amp;amp; @ScriptLineNumber)&lt;br /&gt;
&lt;br /&gt;
; Insert some text at the ViewCursor.&lt;br /&gt;
_LOWriter_DocInsertString($oDoc, $oViewCursor, &amp;quot;Hello from LibreOffice, and AutoIt!&amp;quot;)&lt;br /&gt;
If @error Then Exit MsgBox($MB_OK + $MB_ICONERROR + $MB_TOPMOST, &amp;quot;Error&amp;quot;, &amp;quot;Failed to insert text. Error:&amp;quot; &amp;amp; @error &amp;amp; &amp;quot; Extended:&amp;quot; &amp;amp; @extended &amp;amp; &amp;quot; On Line: &amp;quot; &amp;amp; @ScriptLineNumber)&lt;br /&gt;
&lt;br /&gt;
; Create a unique file name&lt;br /&gt;
Global $sSavePath = _TempFile(@DesktopDir &amp;amp; &amp;quot;\&amp;quot;, &amp;quot;DocTestFile_&amp;quot;, &amp;quot;.odt&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
; Save The Document To Desktop Directory.&lt;br /&gt;
_LOWriter_DocSaveAs($oDoc, $sSavePath)&lt;br /&gt;
If @error Then Exit MsgBox($MB_OK + $MB_ICONERROR + $MB_TOPMOST, &amp;quot;Error&amp;quot;, &amp;quot;Failed to save the Writer Document. Error:&amp;quot; &amp;amp; @error &amp;amp; &amp;quot; Extended:&amp;quot; &amp;amp; @extended &amp;amp; &amp;quot; On Line: &amp;quot; &amp;amp; @ScriptLineNumber)&lt;br /&gt;
&lt;br /&gt;
; Close the document.&lt;br /&gt;
_LOWriter_DocClose($oDoc, False)&lt;br /&gt;
If @error Then Exit MsgBox($MB_OK + $MB_ICONERROR + $MB_TOPMOST, &amp;quot;Error&amp;quot;, &amp;quot;Failed to close opened L.O. Document. Error:&amp;quot; &amp;amp; @error &amp;amp; &amp;quot; Extended:&amp;quot; &amp;amp; @extended &amp;amp; &amp;quot; On Line: &amp;quot; &amp;amp; @ScriptLineNumber)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Starting Portable LibreOffice Example===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;autoit&amp;quot;&amp;gt;&lt;br /&gt;
#include &amp;lt;MsgBoxConstants.au3&amp;gt;&lt;br /&gt;
#include &amp;lt;File.au3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
#include &amp;quot;LibreOffice_Helper.au3&amp;quot;&lt;br /&gt;
#include &amp;quot;LibreOfficeCalc.au3&amp;quot;&lt;br /&gt;
#include &amp;quot;LibreOfficeWriter.au3&amp;quot;&lt;br /&gt;
&lt;br /&gt;
; Update this path to match the path to your Portable LibreOffice/OpenOffice folder.&lt;br /&gt;
Global $sPathToPortable = &amp;quot;C:\Portable Apps\LibreOfficePortablePrevious&amp;quot;&lt;br /&gt;
&lt;br /&gt;
; Initialize Portable LibreOffice&lt;br /&gt;
_LO_InitializePortable($sPathToPortable)&lt;br /&gt;
If @error Then Exit MsgBox($MB_OK + $MB_ICONERROR + $MB_TOPMOST, &amp;quot;Error&amp;quot;, &amp;quot;Failed to Initialize L.O. Error:&amp;quot; &amp;amp; @error &amp;amp; &amp;quot; Extended:&amp;quot; &amp;amp; @extended &amp;amp; &amp;quot; On Line: &amp;quot; &amp;amp; @ScriptLineNumber)&lt;br /&gt;
&lt;br /&gt;
; Create a new Writer Document.&lt;br /&gt;
Global $oWriterDoc = _LOWriter_DocCreate(True, False)&lt;br /&gt;
If @error Then Exit MsgBox($MB_OK + $MB_ICONERROR + $MB_TOPMOST, &amp;quot;Error&amp;quot;, &amp;quot;Failed to Create a new Writer Document. Error:&amp;quot; &amp;amp; @error &amp;amp; &amp;quot; Extended:&amp;quot; &amp;amp; @extended &amp;amp; &amp;quot; On Line: &amp;quot; &amp;amp; @ScriptLineNumber)&lt;br /&gt;
&lt;br /&gt;
; Retrieve the visible document cursor (caret) to insert text with.&lt;br /&gt;
Global $oViewCursor = _LOWriter_DocGetViewCursor($oWriterDoc)&lt;br /&gt;
If @error Then Exit MsgBox($MB_OK + $MB_ICONERROR + $MB_TOPMOST, &amp;quot;Error&amp;quot;, &amp;quot;Failed to retrieve the View Cursor Object for the Writer Document. Error:&amp;quot; &amp;amp; @error &amp;amp; &amp;quot; Extended:&amp;quot; &amp;amp; @extended &amp;amp; &amp;quot; On Line: &amp;quot; &amp;amp; @ScriptLineNumber)&lt;br /&gt;
&lt;br /&gt;
; Insert some text at the ViewCursor.&lt;br /&gt;
_LOWriter_DocInsertString($oWriterDoc, $oViewCursor, &amp;quot;Hello from LibreOffice, and AutoIt!&amp;quot;)&lt;br /&gt;
If @error Then Exit MsgBox($MB_OK + $MB_ICONERROR + $MB_TOPMOST, &amp;quot;Error&amp;quot;, &amp;quot;Failed to insert text. Error:&amp;quot; &amp;amp; @error &amp;amp; &amp;quot; Extended:&amp;quot; &amp;amp; @extended &amp;amp; &amp;quot; On Line: &amp;quot; &amp;amp; @ScriptLineNumber)&lt;br /&gt;
&lt;br /&gt;
; Create a new Calc Document.&lt;br /&gt;
Global $oCalcDoc = _LOCalc_DocCreate(True, False)&lt;br /&gt;
If @error Then Exit MsgBox($MB_OK + $MB_ICONERROR + $MB_TOPMOST, &amp;quot;Error&amp;quot;, &amp;quot;Failed to Create a new Calc Document. Error:&amp;quot; &amp;amp; @error &amp;amp; &amp;quot; Extended:&amp;quot; &amp;amp; @extended &amp;amp; &amp;quot; On Line: &amp;quot; &amp;amp; @ScriptLineNumber)&lt;br /&gt;
&lt;br /&gt;
; Retrieve the presently active Sheet.&lt;br /&gt;
Global $oSheet = _LOCalc_SheetGetActive($oCalcDoc)&lt;br /&gt;
If @error Then Exit MsgBox($MB_OK + $MB_ICONERROR + $MB_TOPMOST, &amp;quot;Error&amp;quot;, &amp;quot;Failed to retrieve the currently active Sheet Object. Error:&amp;quot; &amp;amp; @error &amp;amp; &amp;quot; Extended:&amp;quot; &amp;amp; @extended &amp;amp; &amp;quot; On Line: &amp;quot; &amp;amp; @ScriptLineNumber)&lt;br /&gt;
&lt;br /&gt;
; Retrieve the Object for Cell B1.&lt;br /&gt;
Global $oCell = _LOCalc_RangeGetCellByName($oSheet, &amp;quot;B1&amp;quot;)&lt;br /&gt;
If @error Then Exit MsgBox($MB_OK + $MB_ICONERROR + $MB_TOPMOST, &amp;quot;Error&amp;quot;, &amp;quot;Failed to retrieve B1 Cell Object. Error:&amp;quot; &amp;amp; @error &amp;amp; &amp;quot; Extended:&amp;quot; &amp;amp; @extended &amp;amp; &amp;quot; On Line: &amp;quot; &amp;amp; @ScriptLineNumber)&lt;br /&gt;
&lt;br /&gt;
; Set Cell B1&amp;#039;s Text.&lt;br /&gt;
_LOCalc_CellString($oCell, &amp;quot;Sales&amp;quot;)&lt;br /&gt;
If @error Then Exit MsgBox($MB_OK + $MB_ICONERROR + $MB_TOPMOST, &amp;quot;Error&amp;quot;, &amp;quot;Failed to Set B1 Cell content. Error:&amp;quot; &amp;amp; @error &amp;amp; &amp;quot; Extended:&amp;quot; &amp;amp; @extended &amp;amp; &amp;quot; On Line: &amp;quot; &amp;amp; @ScriptLineNumber)&lt;br /&gt;
&lt;br /&gt;
; Retrieve the Object for Cell B2.&lt;br /&gt;
$oCell = _LOCalc_RangeGetCellByName($oSheet, &amp;quot;B2&amp;quot;)&lt;br /&gt;
If @error Then Exit MsgBox($MB_OK + $MB_ICONERROR + $MB_TOPMOST, &amp;quot;Error&amp;quot;, &amp;quot;Failed to retrieve B2 Cell Object. Error:&amp;quot; &amp;amp; @error &amp;amp; &amp;quot; Extended:&amp;quot; &amp;amp; @extended &amp;amp; &amp;quot; On Line: &amp;quot; &amp;amp; @ScriptLineNumber)&lt;br /&gt;
&lt;br /&gt;
; Set B2 Cell Value to 50&lt;br /&gt;
_LOCalc_CellValue($oCell, 50)&lt;br /&gt;
If @error Then Exit MsgBox($MB_OK + $MB_ICONERROR + $MB_TOPMOST, &amp;quot;Error&amp;quot;, &amp;quot;Failed to Set B2 Cell content. Error:&amp;quot; &amp;amp; @error &amp;amp; &amp;quot; Extended:&amp;quot; &amp;amp; @extended &amp;amp; &amp;quot; On Line: &amp;quot; &amp;amp; @ScriptLineNumber)&lt;br /&gt;
&lt;br /&gt;
; Retrieve the Object for Cell B3.&lt;br /&gt;
$oCell = _LOCalc_RangeGetCellByName($oSheet, &amp;quot;B3&amp;quot;)&lt;br /&gt;
If @error Then Exit MsgBox($MB_OK + $MB_ICONERROR + $MB_TOPMOST, &amp;quot;Error&amp;quot;, &amp;quot;Failed to retrieve B3 Cell Object. Error:&amp;quot; &amp;amp; @error &amp;amp; &amp;quot; Extended:&amp;quot; &amp;amp; @extended &amp;amp; &amp;quot; On Line: &amp;quot; &amp;amp; @ScriptLineNumber)&lt;br /&gt;
&lt;br /&gt;
; Set B3 Cell Value to 15.50&lt;br /&gt;
_LOCalc_CellValue($oCell, 15.50)&lt;br /&gt;
If @error Then Exit MsgBox($MB_OK + $MB_ICONERROR + $MB_TOPMOST, &amp;quot;Error&amp;quot;, &amp;quot;Failed to Set B3 Cell content. Error:&amp;quot; &amp;amp; @error &amp;amp; &amp;quot; Extended:&amp;quot; &amp;amp; @extended &amp;amp; &amp;quot; On Line: &amp;quot; &amp;amp; @ScriptLineNumber)&lt;br /&gt;
&lt;br /&gt;
; Retrieve the Object for Cell A5.&lt;br /&gt;
$oCell = _LOCalc_RangeGetCellByName($oSheet, &amp;quot;A5&amp;quot;)&lt;br /&gt;
If @error Then Exit MsgBox($MB_OK + $MB_ICONERROR + $MB_TOPMOST, &amp;quot;Error&amp;quot;, &amp;quot;Failed to retrieve A5 Cell Object. Error:&amp;quot; &amp;amp; @error &amp;amp; &amp;quot; Extended:&amp;quot; &amp;amp; @extended &amp;amp; &amp;quot; On Line: &amp;quot; &amp;amp; @ScriptLineNumber)&lt;br /&gt;
&lt;br /&gt;
; Set Cell A5&amp;#039;s Text.&lt;br /&gt;
_LOCalc_CellString($oCell, &amp;quot;Total&amp;quot;)&lt;br /&gt;
If @error Then Exit MsgBox($MB_OK + $MB_ICONERROR + $MB_TOPMOST, &amp;quot;Error&amp;quot;, &amp;quot;Failed to Set B1 Cell content. Error:&amp;quot; &amp;amp; @error &amp;amp; &amp;quot; Extended:&amp;quot; &amp;amp; @extended &amp;amp; &amp;quot; On Line: &amp;quot; &amp;amp; @ScriptLineNumber)&lt;br /&gt;
&lt;br /&gt;
; Retrieve the Object for Cell B5.&lt;br /&gt;
$oCell = _LOCalc_RangeGetCellByName($oSheet, &amp;quot;B5&amp;quot;)&lt;br /&gt;
If @error Then Exit MsgBox($MB_OK + $MB_ICONERROR + $MB_TOPMOST, &amp;quot;Error&amp;quot;, &amp;quot;Failed to retrieve A5 Cell Object. Error:&amp;quot; &amp;amp; @error &amp;amp; &amp;quot; Extended:&amp;quot; &amp;amp; @extended &amp;amp; &amp;quot; On Line: &amp;quot; &amp;amp; @ScriptLineNumber)&lt;br /&gt;
&lt;br /&gt;
; Set the Formula for Cell B5&lt;br /&gt;
_LOCalc_CellFormula($oCell, &amp;quot;=SUM(B2:B3)&amp;quot;)&lt;br /&gt;
If @error Then Exit MsgBox($MB_OK + $MB_ICONERROR + $MB_TOPMOST, &amp;quot;Error&amp;quot;, &amp;quot;Failed to Set Cell B5 Formula. Error:&amp;quot; &amp;amp; @error &amp;amp; &amp;quot; Extended:&amp;quot; &amp;amp; @extended &amp;amp; &amp;quot; On Line: &amp;quot; &amp;amp; @ScriptLineNumber)&lt;br /&gt;
&lt;br /&gt;
; Create a unique file name&lt;br /&gt;
Global $sSavePath = _TempFile(@DesktopDir &amp;amp; &amp;quot;\&amp;quot;, &amp;quot;WriterDocTestFile_&amp;quot;, &amp;quot;.odt&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
; Save The Writer Document To Desktop Directory.&lt;br /&gt;
_LOWriter_DocSaveAs($oWriterDoc, $sSavePath)&lt;br /&gt;
If @error Then Exit MsgBox($MB_OK + $MB_ICONERROR + $MB_TOPMOST, &amp;quot;Error&amp;quot;, &amp;quot;Failed to save the Writer Document. Error:&amp;quot; &amp;amp; @error &amp;amp; &amp;quot; Extended:&amp;quot; &amp;amp; @extended &amp;amp; &amp;quot; On Line: &amp;quot; &amp;amp; @ScriptLineNumber)&lt;br /&gt;
&lt;br /&gt;
; Create a unique file name&lt;br /&gt;
$sSavePath = _TempFile(@DesktopDir &amp;amp; &amp;quot;\&amp;quot;, &amp;quot;CalcDocTestFile_&amp;quot;, &amp;quot;.ods&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
; Save The Calc Document To Desktop Directory.&lt;br /&gt;
_LOCalc_DocSaveAs($oCalcDoc, $sSavePath)&lt;br /&gt;
If @error Then Exit MsgBox($MB_OK + $MB_ICONERROR + $MB_TOPMOST, &amp;quot;Error&amp;quot;, &amp;quot;Failed to save the Calc Document. Error:&amp;quot; &amp;amp; @error &amp;amp; &amp;quot; Extended:&amp;quot; &amp;amp; @extended &amp;amp; &amp;quot; On Line: &amp;quot; &amp;amp; @ScriptLineNumber)&lt;br /&gt;
&lt;br /&gt;
; Close the Writer document.&lt;br /&gt;
_LOWriter_DocClose($oWriterDoc, False)&lt;br /&gt;
If @error Then Exit MsgBox($MB_OK + $MB_ICONERROR + $MB_TOPMOST, &amp;quot;Error&amp;quot;, &amp;quot;Failed to close opened L.O. Document. Error:&amp;quot; &amp;amp; @error &amp;amp; &amp;quot; Extended:&amp;quot; &amp;amp; @extended &amp;amp; &amp;quot; On Line: &amp;quot; &amp;amp; @ScriptLineNumber)&lt;br /&gt;
&lt;br /&gt;
; Close the Calc Document.&lt;br /&gt;
_LOCalc_DocClose($oCalcDoc, False)&lt;br /&gt;
If @error Then Exit MsgBox($MB_OK + $MB_ICONERROR + $MB_TOPMOST, &amp;quot;Error&amp;quot;, &amp;quot;Failed to Close the Calc Document. Error:&amp;quot; &amp;amp; @error &amp;amp; &amp;quot; Extended:&amp;quot; &amp;amp; @extended &amp;amp; &amp;quot; On Line: &amp;quot; &amp;amp; @ScriptLineNumber)&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;/div&gt;</summary>
		<author><name>Water</name></author>
	</entry>
</feed>