Add properties

This commit is contained in:
Mauricio Baeza 2021-07-02 22:10:16 -05:00
parent 370bdae3bb
commit 298fceb1e2
12 changed files with 355 additions and 14 deletions

View File

@ -20,17 +20,21 @@ LibreOffice SDK 7.0+
This extension have a cost of maintenance of 1 euros every year.
BCH: `qztd3l00xle5tffdqvh2snvadkuau2ml0uqm4n875d`
In order of preferred.
MONERO: `48ygK6NuuNAfwWfeAbeK8YP2ryPqxMAsUZBnfAhaHVkoHZ48JRYiQKKFd5GFMmaytyUpfxnyA95pWavjRgPUuKv1TUTvhkd`
Mauricio Baeza
Euros
IBAN: BE60 9671 0556 5870
SWIFT / BIC: TRWIBEB1XXX
BTC: `3FhiXcXmAesmQzrNEngjHFnvaJRhU1AGWV`
* FairCoin: `fJ7emvtyGfvcMuxk1nHSnS7gmeScdcZXL5`
* Monero: `43H43TpQKYdYcw2ZCnn2nbjDh3imNQg8RGYS4oP4p7Z8aeBHg6VpeaFfBoMzDTUUDdQBiGkiQUSydJB96m6MqiEuEeyoopQ`
* BCH: `qztd3l00xle5tffdqvh2snvadkuau2ml0uqm4n875d`
ETH: `0x61a4f614a30ff686445751ed8328b82b77ecfc69`
LTC: `MBcgQ3LQJA4W2wsXknTdm2fxRSysLaBJHS`
You have others cryptos, welcome too!
* ETH: `0x61a4f614a30ff686445751ed8328b82b77ecfc69`
* XRP: `rLSn6Z3T8uCxbcd1oxwfGQN1Fdn5CyGujK` Tag: `6643162`
* LTC: `MBcgQ3LQJA4W2wsXknTdm2fxRSysLaBJHS`
* BTC: `3FhiXcXmAesmQzrNEngjHFnvaJRhU1AGWV`
## Extensions develop with ZAZ

Binary file not shown.

Binary file not shown.

View File

@ -209,6 +209,30 @@ To PDF
Export
^^^^^^
* Export common formats
.. code-block:: python
doc = app.docs.new()
path = '/home/mau/myfile.xlsx'
filter_name = 'xlsx'
doc.export(path, filter_name)
path = '/home/mau/myfile.xls'
filter_name = 'xls'
doc.export(path, filter_name)
doc = app.docs.new('writer')
path = '/home/mau/myfile.docx'
filter_name = 'docx'
doc.export(path, filter_name)
path = '/home/mau/myfile.doc'
filter_name = 'doc'
doc.export(path, filter_name)
* For all support formats look `Apendix`_
Fonst
^^^^^
@ -251,7 +275,19 @@ You can call any `dispatch command`_ used only if property or method no exists i
Properties
^^^^^^^^^^
Title
obj
~~~
* Get original object pyUNO (read only)
.. code-block:: python
doc = app.active
app.msgbox(type(doc))
app.msgbox(type(doc.obj))
title
~~~~~
.. code-block:: python
@ -260,5 +296,84 @@ Title
app.msgbox(doc.title)
type
~~~~
* Get type document: calc, writer, etc.
.. code-block:: python
doc = app.active
app.msgbox(doc.type)
uid
~~~
* Get internal RuntimeUID form document.
.. code-block:: python
doc = app.active
app.msgbox(doc.uid)
is_saved
~~~~~~~~
* If document is saved in this or not
.. code-block:: python
doc = app.active
app.msgbox(doc.is_saved)
is_modified
~~~~~~~~~~~
* If document has been modified
.. code-block:: python
doc = app.active
app.msgbox(doc.is_modified)
is_read_only
~~~~~~~~~~~~
.. code-block:: python
doc = app.active
app.msgbox(doc.is_read_only)
path
~~~~
* Get path of document.
.. code-block:: python
doc = app.active
app.msgbox(doc.path)
dir
~~~~
* Get only directory from path saved
.. code-block:: python
doc = app.active
app.msgbox(doc.dir)
.. _dispatch command: https://wiki.documentfoundation.org/Development/DispatchCommands
.. _support filters: https://help.libreoffice.org/latest/en-US/text/shared/guide/convertfilters.html
.. _Apendix: apendixes.html

View File

@ -200,6 +200,31 @@
</section>
<section id="export">
<h2>Export<a class="headerlink" href="#export" title="Permalink to this headline"></a></h2>
<ul class="simple">
<li><p>Export common formats</p></li>
</ul>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">doc</span> <span class="o">=</span> <span class="n">app</span><span class="o">.</span><span class="n">docs</span><span class="o">.</span><span class="n">new</span><span class="p">()</span>
<span class="n">path</span> <span class="o">=</span> <span class="s1">&#39;/home/mau/myfile.xlsx&#39;</span>
<span class="n">filter_name</span> <span class="o">=</span> <span class="s1">&#39;xlsx&#39;</span>
<span class="n">doc</span><span class="o">.</span><span class="n">export</span><span class="p">(</span><span class="n">path</span><span class="p">,</span> <span class="n">filter_name</span><span class="p">)</span>
<span class="n">path</span> <span class="o">=</span> <span class="s1">&#39;/home/mau/myfile.xls&#39;</span>
<span class="n">filter_name</span> <span class="o">=</span> <span class="s1">&#39;xls&#39;</span>
<span class="n">doc</span><span class="o">.</span><span class="n">export</span><span class="p">(</span><span class="n">path</span><span class="p">,</span> <span class="n">filter_name</span><span class="p">)</span>
<span class="n">doc</span> <span class="o">=</span> <span class="n">app</span><span class="o">.</span><span class="n">docs</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="s1">&#39;writer&#39;</span><span class="p">)</span>
<span class="n">path</span> <span class="o">=</span> <span class="s1">&#39;/home/mau/myfile.docx&#39;</span>
<span class="n">filter_name</span> <span class="o">=</span> <span class="s1">&#39;docx&#39;</span>
<span class="n">doc</span><span class="o">.</span><span class="n">export</span><span class="p">(</span><span class="n">path</span><span class="p">,</span> <span class="n">filter_name</span><span class="p">)</span>
<span class="n">path</span> <span class="o">=</span> <span class="s1">&#39;/home/mau/myfile.doc&#39;</span>
<span class="n">filter_name</span> <span class="o">=</span> <span class="s1">&#39;doc&#39;</span>
<span class="n">doc</span><span class="o">.</span><span class="n">export</span><span class="p">(</span><span class="n">path</span><span class="p">,</span> <span class="n">filter_name</span><span class="p">)</span>
</pre></div>
</div>
<ul class="simple">
<li><p>For all support formats look <a class="reference external" href="apendixes.html">Apendix</a></p></li>
</ul>
</section>
<section id="fonst">
<h2>Fonst<a class="headerlink" href="#fonst" title="Permalink to this headline"></a></h2>
@ -236,13 +261,91 @@
</section>
<section id="properties">
<h2>Properties<a class="headerlink" href="#properties" title="Permalink to this headline"></a></h2>
<section id="obj">
<h3>obj<a class="headerlink" href="#obj" title="Permalink to this headline"></a></h3>
<ul class="simple">
<li><p>Get original object pyUNO (read only)</p></li>
</ul>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">doc</span> <span class="o">=</span> <span class="n">app</span><span class="o">.</span><span class="n">active</span>
<span class="n">app</span><span class="o">.</span><span class="n">msgbox</span><span class="p">(</span><span class="nb">type</span><span class="p">(</span><span class="n">doc</span><span class="p">))</span>
<span class="n">app</span><span class="o">.</span><span class="n">msgbox</span><span class="p">(</span><span class="nb">type</span><span class="p">(</span><span class="n">doc</span><span class="o">.</span><span class="n">obj</span><span class="p">))</span>
</pre></div>
</div>
</section>
<section id="title">
<h3>Title<a class="headerlink" href="#title" title="Permalink to this headline"></a></h3>
<h3>title<a class="headerlink" href="#title" title="Permalink to this headline"></a></h3>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">doc</span> <span class="o">=</span> <span class="n">app</span><span class="o">.</span><span class="n">active</span>
<span class="n">app</span><span class="o">.</span><span class="n">msgbox</span><span class="p">(</span><span class="n">doc</span><span class="o">.</span><span class="n">title</span><span class="p">)</span>
</pre></div>
</div>
</section>
<section id="type">
<h3>type<a class="headerlink" href="#type" title="Permalink to this headline"></a></h3>
<ul class="simple">
<li><p>Get type document: calc, writer, etc.</p></li>
</ul>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">doc</span> <span class="o">=</span> <span class="n">app</span><span class="o">.</span><span class="n">active</span>
<span class="n">app</span><span class="o">.</span><span class="n">msgbox</span><span class="p">(</span><span class="n">doc</span><span class="o">.</span><span class="n">type</span><span class="p">)</span>
</pre></div>
</div>
</section>
<section id="uid">
<h3>uid<a class="headerlink" href="#uid" title="Permalink to this headline"></a></h3>
<ul class="simple">
<li><p>Get internal RuntimeUID form document.</p></li>
</ul>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">doc</span> <span class="o">=</span> <span class="n">app</span><span class="o">.</span><span class="n">active</span>
<span class="n">app</span><span class="o">.</span><span class="n">msgbox</span><span class="p">(</span><span class="n">doc</span><span class="o">.</span><span class="n">uid</span><span class="p">)</span>
</pre></div>
</div>
</section>
<section id="is-saved">
<h3>is_saved<a class="headerlink" href="#is-saved" title="Permalink to this headline"></a></h3>
<ul class="simple">
<li><p>If document is saved in this or not</p></li>
</ul>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">doc</span> <span class="o">=</span> <span class="n">app</span><span class="o">.</span><span class="n">active</span>
<span class="n">app</span><span class="o">.</span><span class="n">msgbox</span><span class="p">(</span><span class="n">doc</span><span class="o">.</span><span class="n">is_saved</span><span class="p">)</span>
</pre></div>
</div>
</section>
<section id="is-modified">
<h3>is_modified<a class="headerlink" href="#is-modified" title="Permalink to this headline"></a></h3>
<ul class="simple">
<li><p>If document has been modified</p></li>
</ul>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">doc</span> <span class="o">=</span> <span class="n">app</span><span class="o">.</span><span class="n">active</span>
<span class="n">app</span><span class="o">.</span><span class="n">msgbox</span><span class="p">(</span><span class="n">doc</span><span class="o">.</span><span class="n">is_modified</span><span class="p">)</span>
</pre></div>
</div>
</section>
<section id="is-read-only">
<h3>is_read_only<a class="headerlink" href="#is-read-only" title="Permalink to this headline"></a></h3>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">doc</span> <span class="o">=</span> <span class="n">app</span><span class="o">.</span><span class="n">active</span>
<span class="n">app</span><span class="o">.</span><span class="n">msgbox</span><span class="p">(</span><span class="n">doc</span><span class="o">.</span><span class="n">is_read_only</span><span class="p">)</span>
</pre></div>
</div>
</section>
<section id="path">
<h3>path<a class="headerlink" href="#path" title="Permalink to this headline"></a></h3>
<ul class="simple">
<li><p>Get path of document.</p></li>
</ul>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">doc</span> <span class="o">=</span> <span class="n">app</span><span class="o">.</span><span class="n">active</span>
<span class="n">app</span><span class="o">.</span><span class="n">msgbox</span><span class="p">(</span><span class="n">doc</span><span class="o">.</span><span class="n">path</span><span class="p">)</span>
</pre></div>
</div>
</section>
<section id="dir">
<h3>dir<a class="headerlink" href="#dir" title="Permalink to this headline"></a></h3>
<ul class="simple">
<li><p>Get only directory from path saved</p></li>
</ul>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">doc</span> <span class="o">=</span> <span class="n">app</span><span class="o">.</span><span class="n">active</span>
<span class="n">app</span><span class="o">.</span><span class="n">msgbox</span><span class="p">(</span><span class="n">doc</span><span class="o">.</span><span class="n">dir</span><span class="p">)</span>
</pre></div>
</div>
</section>
</section>
</section>
@ -279,6 +382,7 @@
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="examples.html">Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="apendixes.html">Apendixes</a></li>
</ul>
<div class="relations">

View File

@ -188,6 +188,7 @@
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="examples.html">Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="apendixes.html">Apendixes</a></li>
</ul>
<div class="relations">

View File

@ -168,6 +168,7 @@
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="examples.html">Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="apendixes.html">Apendixes</a></li>
</ul>
<div class="relations">

View File

@ -614,6 +614,7 @@
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="examples.html">Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="apendixes.html">Apendixes</a></li>
</ul>
<div class="relations">

View File

@ -534,6 +534,7 @@ drwxr-xr-x <span class="m">2</span> mau mau <span class="m">4</span>.0K Jun <sp
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="examples.html">Examples</a></li>
<li class="toctree-l1"><a class="reference internal" href="apendixes.html">Apendixes</a></li>
</ul>
<div class="relations">

File diff suppressed because one or more lines are too long

View File

@ -275,15 +275,129 @@ You can call any `dispatch command`_ used only if property or method no exists i
Properties
^^^^^^^^^^
Title
obj
~~~
* Get original object pyUNO (read only)
.. code-block:: python
doc = app.active
app.msgbox(type(doc))
app.msgbox(type(doc.obj))
title
~~~~~
.. code-block:: python
doc = app.active
app.msgbox(doc.title)
doc.title = 'New title'
app.msgbox(doc.title)
type
~~~~
* Get type document: calc, writer, etc. (read only)
.. code-block:: python
doc = app.active
app.msgbox(doc.type)
uid
~~~
* Get internal RuntimeUID form document. (read only)
.. code-block:: python
doc = app.active
app.msgbox(doc.uid)
is_saved
~~~~~~~~
* If document is saved in this or not (read only)
.. code-block:: python
doc = app.active
app.msgbox(doc.is_saved)
is_modified
~~~~~~~~~~~
* If document has been modified (read only)
.. code-block:: python
doc = app.active
app.msgbox(doc.is_modified)
is_read_only
~~~~~~~~~~~~
.. code-block:: python
doc = app.active
app.msgbox(doc.is_read_only)
path
~~~~
* Get path of document. (read only)
.. code-block:: python
doc = app.active
app.msgbox(doc.path)
dir
~~~
* Get only directory from path saved (read only)
.. code-block:: python
doc = app.active
app.msgbox(doc.dir)
file_name
~~~~~~~~~
* Get only file name from path saved (read only)
.. code-block:: python
doc = app.active
app.msgbox(doc.file_name)
name
~~~~
* Get only name without extension (read only)
.. code-block:: python
doc = app.active
app.msgbox(doc.file_name)
.. _dispatch command: https://wiki.documentfoundation.org/Development/DispatchCommands
.. _support filters: https://help.libreoffice.org/latest/en-US/text/shared/guide/convertfilters.html
.. _Apendix: apendix
.. _Apendix: apendixes.html

View File

@ -1103,7 +1103,7 @@ class LODocument(object):
@property
def is_read_only(self):
return self.obj.isReadOnly()
return self.obj.isReadonly()
@property
def path(self):