Add apendix
This commit is contained in:
parent
90dae8a9b4
commit
42141fa06d
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -14,6 +14,7 @@ Welcome to ZAZ's documentation!
|
|||
main/config
|
||||
main/easymacro
|
||||
main/examples
|
||||
main/apendixes
|
||||
|
||||
|
||||
Indices and tables
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
|
||||
Apendixes
|
||||
---------
|
||||
|
||||
Remember, always import library.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import easymacro as app
|
||||
|
||||
|
||||
Get all filters in Calc sheet
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
* Fields in filter
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
'Finalized': False,
|
||||
'UIName': 'EPS - Encapsulated PostScript',
|
||||
'UserData': <ByteSequence instance 'b'''>,
|
||||
'TemplateName': '',
|
||||
'Enabled': True,
|
||||
'Mandatory': False,
|
||||
'Name': 'impress_eps_Export',
|
||||
'FilterService': '',
|
||||
'Type': 'eps_Encapsulated_PostScript',
|
||||
'UIComponent': 'com.sun.star.svtools.SvFilterOptionsDialog',
|
||||
'Flags': 1090,
|
||||
'FileFormatVersion': 0,
|
||||
'DocumentService': 'com.sun.star.presentation.PresentationDocument',
|
||||
'UINames': {
|
||||
'en-US': 'EPS - Encapsulated PostScript',
|
||||
'es': 'EPS - PostScript encapsulado'}
|
||||
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
filters = app.get_filters()
|
||||
headers = (('DocumentService', 'UIName', 'Name', 'Type'),)
|
||||
data = [(f['DocumentService'], f['UIName'], f['Name'], f['Type'])
|
||||
for f in filters]
|
||||
|
||||
doc = app.docs.new()
|
||||
doc[0]['A1'].data = headers
|
||||
doc[0]['A2'].data = data
|
|
@ -75,6 +75,16 @@ Get by name
|
|||
app.msgbox(doc.title)
|
||||
|
||||
|
||||
If contain
|
||||
^^^^^^^^^^
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
result = 'myfile.ods' in app.docs
|
||||
app.msgbox(result)
|
||||
|
||||
|
||||
|
||||
New
|
||||
^^^
|
||||
|
||||
|
@ -145,6 +155,37 @@ With arguments.
|
|||
Save
|
||||
^^^^
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
path = '/home/mau/myfile.ods'
|
||||
doc = app.docs.new()
|
||||
doc.save(path)
|
||||
|
||||
* If previously open and modify any file.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
doc.save()
|
||||
|
||||
* Open exists file and save with other name.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
path = '/home/mau/myfile.ods'
|
||||
doc = app.docs.open(path)
|
||||
new_path = '/srv/mau/other_name.ods'
|
||||
doc.save(new_path)
|
||||
|
||||
|
||||
Close
|
||||
^^^^^
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
doc = app.docs.new()
|
||||
app.msgbox(doc.title)
|
||||
doc.close()
|
||||
|
||||
|
||||
To PDF
|
||||
^^^^^^
|
||||
|
@ -181,6 +222,20 @@ Fonst
|
|||
print(f'Name: {f.Name} - StyleName: {f.StyleName}')
|
||||
|
||||
|
||||
Filters
|
||||
^^^^^^^
|
||||
|
||||
* Get all `support filters`_
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
filters = app.get_filters()
|
||||
ds = []
|
||||
for f in filters:
|
||||
data = f"UI Name: {f['UIName']} - Name: {f['Name']} - Type: {f['Type']}"
|
||||
app.debug(data)
|
||||
|
||||
|
||||
Call dispatch
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
|
@ -193,5 +248,17 @@ You can call any `dispatch command`_ used only if property or method no exists i
|
|||
app.call_dispatch(doc, command)
|
||||
|
||||
|
||||
Properties
|
||||
^^^^^^^^^^
|
||||
|
||||
Title
|
||||
~~~~~
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
doc = app.active
|
||||
app.msgbox(doc.title)
|
||||
|
||||
|
||||
.. _dispatch command: https://wiki.documentfoundation.org/Development/DispatchCommands
|
||||
.. _support filters: https://help.libreoffice.org/latest/en-US/text/shared/guide/convertfilters.html
|
||||
|
|
|
@ -45,7 +45,7 @@ Send email
|
|||
cc = 'other@correo.com'
|
||||
bcc = 'hidden@correo.com'
|
||||
|
||||
* We can send to more than one message.
|
||||
* We can send too more than one message.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
|
@ -57,7 +57,7 @@ Send email
|
|||
message2 = dict(
|
||||
to = 'sophia.loren@email.net',
|
||||
subject = 'I love you',
|
||||
body = "Hello Ingrid\n\nWho are you?\n\nBest regards",
|
||||
body = "Hello Sophia\n\nWho are you?\n\nBest regards",
|
||||
)
|
||||
messages = (message1, message2)
|
||||
|
||||
|
@ -91,6 +91,19 @@ Send email
|
|||
'/home/mau/file2.epub',
|
||||
)
|
||||
|
||||
* If your client email used `mbox` format, we can save in any path into your email client configuration.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
path_save = '/home/mau/.thunderbird/7iznrbyw.default/Mail/Local Folders/LibreOffice'
|
||||
message = dict(
|
||||
to = 'ingrid.bergman@email.net',
|
||||
subject = 'I love you',
|
||||
body = "Hello Ingrid\n\nWho are you?\n\nBest regards",
|
||||
path = path_save
|
||||
)
|
||||
app.send_email(SERVER, message)
|
||||
|
||||
|
||||
* All emails always send in other thread.
|
||||
|
||||
|
|
|
@ -60,6 +60,7 @@
|
|||
<li class="toctree-l1"><a class="reference internal" href="main/config.html">Configuration</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="main/easymacro.html">Library easymacro.py</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="main/examples.html">Examples</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="main/apendixes.html">Apendixes</a></li>
|
||||
</ul>
|
||||
|
||||
<div class="relations">
|
||||
|
|
|
@ -67,6 +67,10 @@
|
|||
<li class="toctree-l2"><a class="reference internal" href="main/examples_base.html">For Base</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="main/apendixes.html">Apendixes</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="main/apendixes.html#get-all-filters-in-calc-sheet">Get all filters in Calc sheet</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</section>
|
||||
|
@ -102,6 +106,7 @@
|
|||
<li class="toctree-l1"><a class="reference internal" href="main/config.html">Configuration</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="main/easymacro.html">Library easymacro.py</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="main/examples.html">Examples</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="main/apendixes.html">Apendixes</a></li>
|
||||
</ul>
|
||||
|
||||
<div class="relations">
|
||||
|
|
|
@ -0,0 +1,152 @@
|
|||
|
||||
<!DOCTYPE html>
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /><meta name="generator" content="Docutils 0.17.1: http://docutils.sourceforge.net/" />
|
||||
|
||||
<title>Apendixes — ZAZ documentation</title>
|
||||
<link rel="stylesheet" type="text/css" href="../_static/pygments.css" />
|
||||
<link rel="stylesheet" type="text/css" href="../_static/alabaster.css" />
|
||||
<script data-url_root="../" id="documentation_options" src="../_static/documentation_options.js"></script>
|
||||
<script src="../_static/jquery.js"></script>
|
||||
<script src="../_static/underscore.js"></script>
|
||||
<script src="../_static/doctools.js"></script>
|
||||
<link rel="index" title="Index" href="../genindex.html" />
|
||||
<link rel="search" title="Search" href="../search.html" />
|
||||
<link rel="prev" title="For Base" href="examples_base.html" />
|
||||
|
||||
<link rel="stylesheet" href="../_static/custom.css" type="text/css" />
|
||||
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=0.9, maximum-scale=0.9" />
|
||||
|
||||
</head><body>
|
||||
|
||||
|
||||
<div class="document">
|
||||
<div class="documentwrapper">
|
||||
<div class="bodywrapper">
|
||||
|
||||
|
||||
<div class="body" role="main">
|
||||
|
||||
<section id="apendixes">
|
||||
<h1>Apendixes<a class="headerlink" href="#apendixes" title="Permalink to this headline">¶</a></h1>
|
||||
<p>Remember, always import library.</p>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="kn">import</span> <span class="nn">easymacro</span> <span class="k">as</span> <span class="nn">app</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<section id="get-all-filters-in-calc-sheet">
|
||||
<h2>Get all filters in Calc sheet<a class="headerlink" href="#get-all-filters-in-calc-sheet" title="Permalink to this headline">¶</a></h2>
|
||||
<ul class="simple">
|
||||
<li><p>Fields in filter</p></li>
|
||||
</ul>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="s1">'Finalized'</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
|
||||
<span class="s1">'UIName'</span><span class="p">:</span> <span class="s1">'EPS - Encapsulated PostScript'</span><span class="p">,</span>
|
||||
<span class="s1">'UserData'</span><span class="p">:</span> <span class="o"><</span><span class="n">ByteSequence</span> <span class="n">instance</span> <span class="s1">'b'''</span><span class="o">></span><span class="p">,</span>
|
||||
<span class="s1">'TemplateName'</span><span class="p">:</span> <span class="s1">''</span><span class="p">,</span>
|
||||
<span class="s1">'Enabled'</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span>
|
||||
<span class="s1">'Mandatory'</span><span class="p">:</span> <span class="kc">False</span><span class="p">,</span>
|
||||
<span class="s1">'Name'</span><span class="p">:</span> <span class="s1">'impress_eps_Export'</span><span class="p">,</span>
|
||||
<span class="s1">'FilterService'</span><span class="p">:</span> <span class="s1">''</span><span class="p">,</span>
|
||||
<span class="s1">'Type'</span><span class="p">:</span> <span class="s1">'eps_Encapsulated_PostScript'</span><span class="p">,</span>
|
||||
<span class="s1">'UIComponent'</span><span class="p">:</span> <span class="s1">'com.sun.star.svtools.SvFilterOptionsDialog'</span><span class="p">,</span>
|
||||
<span class="s1">'Flags'</span><span class="p">:</span> <span class="mi">1090</span><span class="p">,</span>
|
||||
<span class="s1">'FileFormatVersion'</span><span class="p">:</span> <span class="mi">0</span><span class="p">,</span>
|
||||
<span class="s1">'DocumentService'</span><span class="p">:</span> <span class="s1">'com.sun.star.presentation.PresentationDocument'</span><span class="p">,</span>
|
||||
<span class="s1">'UINames'</span><span class="p">:</span> <span class="p">{</span>
|
||||
<span class="s1">'en-US'</span><span class="p">:</span> <span class="s1">'EPS - Encapsulated PostScript'</span><span class="p">,</span>
|
||||
<span class="s1">'es'</span><span class="p">:</span> <span class="s1">'EPS - PostScript encapsulado'</span><span class="p">}</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">filters</span> <span class="o">=</span> <span class="n">app</span><span class="o">.</span><span class="n">get_filters</span><span class="p">()</span>
|
||||
<span class="n">headers</span> <span class="o">=</span> <span class="p">((</span><span class="s1">'DocumentService'</span><span class="p">,</span> <span class="s1">'UIName'</span><span class="p">,</span> <span class="s1">'Name'</span><span class="p">,</span> <span class="s1">'Type'</span><span class="p">),)</span>
|
||||
<span class="n">data</span> <span class="o">=</span> <span class="p">[(</span><span class="n">f</span><span class="p">[</span><span class="s1">'DocumentService'</span><span class="p">],</span> <span class="n">f</span><span class="p">[</span><span class="s1">'UIName'</span><span class="p">],</span> <span class="n">f</span><span class="p">[</span><span class="s1">'Name'</span><span class="p">],</span> <span class="n">f</span><span class="p">[</span><span class="s1">'Type'</span><span class="p">])</span>
|
||||
<span class="k">for</span> <span class="n">f</span> <span class="ow">in</span> <span class="n">filters</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="n">doc</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="s1">'A1'</span><span class="p">]</span><span class="o">.</span><span class="n">data</span> <span class="o">=</span> <span class="n">headers</span>
|
||||
<span class="n">doc</span><span class="p">[</span><span class="mi">0</span><span class="p">][</span><span class="s1">'A2'</span><span class="p">]</span><span class="o">.</span><span class="n">data</span> <span class="o">=</span> <span class="n">data</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="sphinxsidebar" role="navigation" aria-label="main navigation">
|
||||
<div class="sphinxsidebarwrapper">
|
||||
<h1 class="logo"><a href="../index.html">ZAZ</a></h1>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<h3>Navigation</h3>
|
||||
<p class="caption"><span class="caption-text">Contents:</span></p>
|
||||
<ul class="current">
|
||||
<li class="toctree-l1"><a class="reference internal" href="intro.html">Introduction</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="config.html">Configuration</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="easymacro.html">Library easymacro.py</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="examples.html">Examples</a></li>
|
||||
<li class="toctree-l1 current"><a class="current reference internal" href="#">Apendixes</a><ul>
|
||||
<li class="toctree-l2"><a class="reference internal" href="#get-all-filters-in-calc-sheet">Get all filters in Calc sheet</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="relations">
|
||||
<h3>Related Topics</h3>
|
||||
<ul>
|
||||
<li><a href="../index.html">Documentation overview</a><ul>
|
||||
<li>Previous: <a href="examples_base.html" title="previous chapter">For Base</a></li>
|
||||
</ul></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div id="searchbox" style="display: none" role="search">
|
||||
<h3 id="searchlabel">Quick search</h3>
|
||||
<div class="searchformwrapper">
|
||||
<form class="search" action="../search.html" method="get">
|
||||
<input type="text" name="q" aria-labelledby="searchlabel" />
|
||||
<input type="submit" value="Go" />
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<script>$('#searchbox').show(0);</script>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<div class="clearer"></div>
|
||||
</div>
|
||||
<div class="footer">
|
||||
©2021, Mauricio Baeza.
|
||||
|
||||
|
|
||||
Powered by <a href="http://sphinx-doc.org/">Sphinx 4.0.2</a>
|
||||
& <a href="https://github.com/bitprophet/alabaster">Alabaster 0.7.12</a>
|
||||
|
||||
|
|
||||
<a href="../_sources/main/apendixes.rst.txt"
|
||||
rel="nofollow">Page source</a>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
|
@ -95,6 +95,13 @@
|
|||
</pre></div>
|
||||
</div>
|
||||
</section>
|
||||
<section id="if-contain">
|
||||
<h2>If contain<a class="headerlink" href="#if-contain" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">result</span> <span class="o">=</span> <span class="s1">'myfile.ods'</span> <span class="ow">in</span> <span class="n">app</span><span class="o">.</span><span class="n">docs</span>
|
||||
<span class="n">app</span><span class="o">.</span><span class="n">msgbox</span><span class="p">(</span><span class="n">result</span><span class="p">)</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</section>
|
||||
<section id="new">
|
||||
<h2>New<a class="headerlink" href="#new" title="Permalink to this headline">¶</a></h2>
|
||||
<p>For default create new Calc document.</p>
|
||||
|
@ -144,6 +151,34 @@
|
|||
</section>
|
||||
<section id="save">
|
||||
<h2>Save<a class="headerlink" href="#save" title="Permalink to this headline">¶</a></h2>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">path</span> <span class="o">=</span> <span class="s1">'/home/mau/myfile.ods'</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">doc</span><span class="o">.</span><span class="n">save</span><span class="p">(</span><span class="n">path</span><span class="p">)</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<ul class="simple">
|
||||
<li><p>If previously open and modify any file.</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">save</span><span class="p">()</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<ul class="simple">
|
||||
<li><p>Open exists file and save with other name.</p></li>
|
||||
</ul>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">path</span> <span class="o">=</span> <span class="s1">'/home/mau/myfile.ods'</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">open</span><span class="p">(</span><span class="n">path</span><span class="p">)</span>
|
||||
<span class="n">new_path</span> <span class="o">=</span> <span class="s1">'/srv/mau/other_name.ods'</span>
|
||||
<span class="n">doc</span><span class="o">.</span><span class="n">save</span><span class="p">(</span><span class="n">new_path</span><span class="p">)</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</section>
|
||||
<section id="close">
|
||||
<h2>Close<a class="headerlink" href="#close" title="Permalink to this headline">¶</a></h2>
|
||||
<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">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>
|
||||
<span class="n">doc</span><span class="o">.</span><span class="n">close</span><span class="p">()</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</section>
|
||||
<section id="to-pdf">
|
||||
<h2>To PDF<a class="headerlink" href="#to-pdf" title="Permalink to this headline">¶</a></h2>
|
||||
|
@ -177,6 +212,19 @@
|
|||
</pre></div>
|
||||
</div>
|
||||
</section>
|
||||
<section id="filters">
|
||||
<h2>Filters<a class="headerlink" href="#filters" title="Permalink to this headline">¶</a></h2>
|
||||
<ul class="simple">
|
||||
<li><p>Get all <a class="reference external" href="https://help.libreoffice.org/latest/en-US/text/shared/guide/convertfilters.html">support filters</a></p></li>
|
||||
</ul>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">filters</span> <span class="o">=</span> <span class="n">app</span><span class="o">.</span><span class="n">get_filters</span><span class="p">()</span>
|
||||
<span class="n">ds</span> <span class="o">=</span> <span class="p">[]</span>
|
||||
<span class="k">for</span> <span class="n">f</span> <span class="ow">in</span> <span class="n">filters</span><span class="p">:</span>
|
||||
<span class="n">data</span> <span class="o">=</span> <span class="sa">f</span><span class="s2">"UI Name: </span><span class="si">{</span><span class="n">f</span><span class="p">[</span><span class="s1">'UIName'</span><span class="p">]</span><span class="si">}</span><span class="s2"> - Name: </span><span class="si">{</span><span class="n">f</span><span class="p">[</span><span class="s1">'Name'</span><span class="p">]</span><span class="si">}</span><span class="s2"> - Type: </span><span class="si">{</span><span class="n">f</span><span class="p">[</span><span class="s1">'Type'</span><span class="p">]</span><span class="si">}</span><span class="s2">"</span>
|
||||
<span class="n">app</span><span class="o">.</span><span class="n">debug</span><span class="p">(</span><span class="n">data</span><span class="p">)</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
</section>
|
||||
<section id="call-dispatch">
|
||||
<h2>Call dispatch<a class="headerlink" href="#call-dispatch" title="Permalink to this headline">¶</a></h2>
|
||||
<p>You can call any <a class="reference external" href="https://wiki.documentfoundation.org/Development/DispatchCommands">dispatch command</a> used only if property or method no exists in original object or in <cite>easymacro.py</cite></p>
|
||||
|
@ -186,6 +234,16 @@
|
|||
</pre></div>
|
||||
</div>
|
||||
</section>
|
||||
<section id="properties">
|
||||
<h2>Properties<a class="headerlink" href="#properties" title="Permalink to this headline">¶</a></h2>
|
||||
<section id="title">
|
||||
<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>
|
||||
</section>
|
||||
|
||||
|
||||
|
|
|
@ -125,13 +125,17 @@
|
|||
<li class="toctree-l2"><a class="reference internal" href="application.html#iter-docs">Iter docs</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="application.html#count">Count</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="application.html#get-by-name">Get by name</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="application.html#if-contain">If contain</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="application.html#new">New</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="application.html#open">Open</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="application.html#save">Save</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="application.html#close">Close</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="application.html#to-pdf">To PDF</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="application.html#export">Export</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="application.html#fonst">Fonst</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="application.html#filters">Filters</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="application.html#call-dispatch">Call dispatch</a></li>
|
||||
<li class="toctree-l2"><a class="reference internal" href="application.html#properties">Properties</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="calc.html">Calc</a><ul>
|
||||
|
|
|
@ -72,7 +72,7 @@
|
|||
</pre></div>
|
||||
</div>
|
||||
<ul class="simple">
|
||||
<li><p>We can send to more than one message.</p></li>
|
||||
<li><p>We can send too more than one message.</p></li>
|
||||
</ul>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">message1</span> <span class="o">=</span> <span class="nb">dict</span><span class="p">(</span>
|
||||
<span class="n">to</span> <span class="o">=</span> <span class="s1">'ingrid.bergman@email.net'</span><span class="p">,</span>
|
||||
|
@ -82,7 +82,7 @@
|
|||
<span class="n">message2</span> <span class="o">=</span> <span class="nb">dict</span><span class="p">(</span>
|
||||
<span class="n">to</span> <span class="o">=</span> <span class="s1">'sophia.loren@email.net'</span><span class="p">,</span>
|
||||
<span class="n">subject</span> <span class="o">=</span> <span class="s1">'I love you'</span><span class="p">,</span>
|
||||
<span class="n">body</span> <span class="o">=</span> <span class="s2">"Hello Ingrid</span><span class="se">\n\n</span><span class="s2">Who are you?</span><span class="se">\n\n</span><span class="s2">Best regards"</span><span class="p">,</span>
|
||||
<span class="n">body</span> <span class="o">=</span> <span class="s2">"Hello Sophia</span><span class="se">\n\n</span><span class="s2">Who are you?</span><span class="se">\n\n</span><span class="s2">Best regards"</span><span class="p">,</span>
|
||||
<span class="p">)</span>
|
||||
<span class="n">messages</span> <span class="o">=</span> <span class="p">(</span><span class="n">message1</span><span class="p">,</span> <span class="n">message2</span><span class="p">)</span>
|
||||
|
||||
|
@ -117,6 +117,19 @@
|
|||
</pre></div>
|
||||
</div>
|
||||
<ul class="simple">
|
||||
<li><p>If your client email used <cite>mbox</cite> format, we can save in any path into your email client configuration.</p></li>
|
||||
</ul>
|
||||
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">path_save</span> <span class="o">=</span> <span class="s1">'/home/mau/.thunderbird/7iznrbyw.default/Mail/Local Folders/LibreOffice'</span>
|
||||
<span class="n">message</span> <span class="o">=</span> <span class="nb">dict</span><span class="p">(</span>
|
||||
<span class="n">to</span> <span class="o">=</span> <span class="s1">'ingrid.bergman@email.net'</span><span class="p">,</span>
|
||||
<span class="n">subject</span> <span class="o">=</span> <span class="s1">'I love you'</span><span class="p">,</span>
|
||||
<span class="n">body</span> <span class="o">=</span> <span class="s2">"Hello Ingrid</span><span class="se">\n\n</span><span class="s2">Who are you?</span><span class="se">\n\n</span><span class="s2">Best regards"</span><span class="p">,</span>
|
||||
<span class="n">path</span> <span class="o">=</span> <span class="n">path_save</span>
|
||||
<span class="p">)</span>
|
||||
<span class="n">app</span><span class="o">.</span><span class="n">send_email</span><span class="p">(</span><span class="n">SERVER</span><span class="p">,</span> <span class="n">message</span><span class="p">)</span>
|
||||
</pre></div>
|
||||
</div>
|
||||
<ul class="simple">
|
||||
<li><p>All emails always send in other thread.</p></li>
|
||||
</ul>
|
||||
</section>
|
||||
|
|
Binary file not shown.
|
@ -88,6 +88,7 @@
|
|||
<li class="toctree-l1"><a class="reference internal" href="main/config.html">Configuration</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="main/easymacro.html">Library easymacro.py</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="main/examples.html">Examples</a></li>
|
||||
<li class="toctree-l1"><a class="reference internal" href="main/apendixes.html">Apendixes</a></li>
|
||||
</ul>
|
||||
|
||||
<div class="relations">
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,3 +1,3 @@
|
|||
#!/bin/bash
|
||||
|
||||
rsync -ravz build/ elmau.net:/opt/www/doc/zaz/
|
||||
rsync -ravz --delete build/ elmau.net:/opt/www/doc/zaz/
|
||||
|
|
|
@ -14,6 +14,7 @@ Welcome to ZAZ's documentation!
|
|||
main/config
|
||||
main/easymacro
|
||||
main/examples
|
||||
main/apendixes
|
||||
|
||||
|
||||
Indices and tables
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
|
||||
Apendixes
|
||||
---------
|
||||
|
||||
Remember, always import library.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
import easymacro as app
|
||||
|
||||
|
||||
Get all filters in Calc sheet
|
||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||
|
||||
* Fields in filter
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
'Finalized': False,
|
||||
'UIName': 'EPS - Encapsulated PostScript',
|
||||
'UserData': <ByteSequence instance 'b'''>,
|
||||
'TemplateName': '',
|
||||
'Enabled': True,
|
||||
'Mandatory': False,
|
||||
'Name': 'impress_eps_Export',
|
||||
'FilterService': '',
|
||||
'Type': 'eps_Encapsulated_PostScript',
|
||||
'UIComponent': 'com.sun.star.svtools.SvFilterOptionsDialog',
|
||||
'Flags': 1090,
|
||||
'FileFormatVersion': 0,
|
||||
'DocumentService': 'com.sun.star.presentation.PresentationDocument',
|
||||
'UINames': {
|
||||
'en-US': 'EPS - Encapsulated PostScript',
|
||||
'es': 'EPS - PostScript encapsulado'}
|
||||
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
filters = app.get_filters()
|
||||
headers = (('DocumentService', 'UIName', 'Name', 'Type'),)
|
||||
data = [(f['DocumentService'], f['UIName'], f['Name'], f['Type'])
|
||||
for f in filters]
|
||||
|
||||
doc = app.docs.new()
|
||||
doc[0]['A1'].data = headers
|
||||
doc[0]['A2'].data = data
|
|
@ -75,6 +75,16 @@ Get by name
|
|||
app.msgbox(doc.title)
|
||||
|
||||
|
||||
If contain
|
||||
^^^^^^^^^^
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
result = 'myfile.ods' in app.docs
|
||||
app.msgbox(result)
|
||||
|
||||
|
||||
|
||||
New
|
||||
^^^
|
||||
|
||||
|
@ -145,6 +155,37 @@ With arguments.
|
|||
Save
|
||||
^^^^
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
path = '/home/mau/myfile.ods'
|
||||
doc = app.docs.new()
|
||||
doc.save(path)
|
||||
|
||||
* If previously open and modify any file.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
doc.save()
|
||||
|
||||
* Open exists file and save with other name.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
path = '/home/mau/myfile.ods'
|
||||
doc = app.docs.open(path)
|
||||
new_path = '/srv/mau/other_name.ods'
|
||||
doc.save(new_path)
|
||||
|
||||
|
||||
Close
|
||||
^^^^^
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
doc = app.docs.new()
|
||||
app.msgbox(doc.title)
|
||||
doc.close()
|
||||
|
||||
|
||||
To PDF
|
||||
^^^^^^
|
||||
|
@ -181,6 +222,20 @@ Fonst
|
|||
print(f'Name: {f.Name} - StyleName: {f.StyleName}')
|
||||
|
||||
|
||||
Filters
|
||||
^^^^^^^
|
||||
|
||||
* Get all `support filters`_
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
filters = app.get_filters()
|
||||
ds = []
|
||||
for f in filters:
|
||||
data = f"UI Name: {f['UIName']} - Name: {f['Name']} - Type: {f['Type']}"
|
||||
app.debug(data)
|
||||
|
||||
|
||||
Call dispatch
|
||||
^^^^^^^^^^^^^
|
||||
|
||||
|
@ -193,5 +248,17 @@ You can call any `dispatch command`_ used only if property or method no exists i
|
|||
app.call_dispatch(doc, command)
|
||||
|
||||
|
||||
Properties
|
||||
^^^^^^^^^^
|
||||
|
||||
Title
|
||||
~~~~~
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
doc = app.active
|
||||
app.msgbox(doc.title)
|
||||
|
||||
|
||||
.. _dispatch command: https://wiki.documentfoundation.org/Development/DispatchCommands
|
||||
.. _support filters: https://help.libreoffice.org/latest/en-US/text/shared/guide/convertfilters.html
|
||||
|
|
|
@ -45,7 +45,7 @@ Send email
|
|||
cc = 'other@correo.com'
|
||||
bcc = 'hidden@correo.com'
|
||||
|
||||
* We can send to more than one message.
|
||||
* We can send too more than one message.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
|
@ -57,7 +57,7 @@ Send email
|
|||
message2 = dict(
|
||||
to = 'sophia.loren@email.net',
|
||||
subject = 'I love you',
|
||||
body = "Hello Ingrid\n\nWho are you?\n\nBest regards",
|
||||
body = "Hello Sophia\n\nWho are you?\n\nBest regards",
|
||||
)
|
||||
messages = (message1, message2)
|
||||
|
||||
|
@ -91,6 +91,19 @@ Send email
|
|||
'/home/mau/file2.epub',
|
||||
)
|
||||
|
||||
* If your client email used `mbox` format, we can save in any path into your email client configuration.
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
path_save = '/home/mau/.thunderbird/7iznrbyw.default/Mail/Local Folders/LibreOffice'
|
||||
message = dict(
|
||||
to = 'ingrid.bergman@email.net',
|
||||
subject = 'I love you',
|
||||
body = "Hello Ingrid\n\nWho are you?\n\nBest regards",
|
||||
path = path_save
|
||||
)
|
||||
app.send_email(SERVER, message)
|
||||
|
||||
|
||||
* All emails always send in other thread.
|
||||
|
||||
|
|
|
@ -1058,10 +1058,6 @@ class LOBaseObject(object):
|
|||
|
||||
|
||||
class LODocument(object):
|
||||
FILTERS = {
|
||||
'doc': 'MS Word 97',
|
||||
'docx': 'MS Word 2007 XML',
|
||||
}
|
||||
|
||||
def __init__(self, obj):
|
||||
self._obj = obj
|
||||
|
@ -1233,10 +1229,14 @@ class LODocument(object):
|
|||
|
||||
return stream
|
||||
|
||||
def export(self, path: str, ext: str='', args: dict={}):
|
||||
if not ext:
|
||||
ext = _P(path).ext
|
||||
filter_name = self.FILTERS[ext]
|
||||
def export(self, path: str, filter_name: str, args: dict={}):
|
||||
FILTERS = {
|
||||
'xlsx': 'Calc MS Excel 2007 XML',
|
||||
'xls': 'MS Excel 97',
|
||||
'docx': 'MS Word 2007 XML',
|
||||
'doc': 'MS Word 97',
|
||||
}
|
||||
filter_name = FILTERS.get(filter_name, filter_name)
|
||||
filter_data = dict_to_property(args, True)
|
||||
args = {
|
||||
'FilterName': filter_name,
|
||||
|
@ -1248,6 +1248,7 @@ class LODocument(object):
|
|||
except Exception as e:
|
||||
error(e)
|
||||
path = ''
|
||||
|
||||
return _P.exists(path)
|
||||
|
||||
def save(self, path: str='', args: dict={}) -> bool:
|
||||
|
@ -6861,6 +6862,18 @@ def get_fonts():
|
|||
return device.FontDescriptors
|
||||
|
||||
|
||||
def get_filters():
|
||||
"""
|
||||
Get all support filters
|
||||
https://help.libreoffice.org/latest/en-US/text/shared/guide/convertfilters.html
|
||||
"""
|
||||
factory = create_instance('com.sun.star.document.FilterFactory')
|
||||
rows = [data_to_dict(factory[name]) for name in factory]
|
||||
for row in rows:
|
||||
row['UINames'] = data_to_dict(row['UINames'])
|
||||
return rows
|
||||
|
||||
|
||||
# ~ https://en.wikipedia.org/wiki/Web_colors
|
||||
def get_color(value):
|
||||
COLORS = {
|
||||
|
|
Loading…
Reference in New Issue