Add new example Calc

This commit is contained in:
Mauricio Baeza 2021-07-11 22:31:59 -05:00
parent cdbb00fad4
commit 33c86dcd56
15 changed files with 89 additions and 12 deletions

View File

@ -8,7 +8,8 @@ Develop in pure Python, not need any dependence.
* LibreOffice 7.0+
* LibreOffice SDK 7.0+
* Look [documentation](https://doc.cuates.net/zaz/)
#### Look [documentation](https://doc.cuates.net/zaz/)
## Free Software, not gratis software

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -157,13 +157,13 @@ Copy
.. code-block:: python
sheet = doc[0]
doc.copy(sheet, 'OtherSheet')
doc.copy_sheet(sheet, 'OtherSheet')
* By name
.. code-block:: python
doc.copy('Sheet1', 'Sheet2')
doc.copy_sheet('Sheet1', 'Sheet2')
* From sheet

View File

@ -21,3 +21,27 @@ Automatic calculate size range.
)
sheet['A1'].data = data
return
Copy visible cells
^^^^^^^^^^^^^^^^^^
.. code-block:: python
doc = app.active
rangos = doc.active['A1'].current_region.visible
doc.select(rangos)
doc.copy()
doc.active['A15'].select()
doc.paste()
Merge by row
^^^^^^^^^^^^
.. code-block:: python
rango = app.selection
rango.merge_by_row()

View File

@ -1,9 +1,9 @@
For Writer
-------------------
----------
Set autostyle in table
^^^^^^^^^^^^^^^^^^^^^^
~~~~~~~~~~~~~~~~~~~~~~
.. code-block:: python
@ -12,3 +12,13 @@ Set autostyle in table
table = doc.tables[0]
table.style = 'Academic'
return
Insert math formula
~~~~~~~~~~~~~~~~~~~
.. code-block:: python
formula = '%LAMBDA_{deg","t}=1 + %alpha_deg SQRT {M_t over M_{(t=0)}-1}~"."'
text = app.selection
text.insert_math(formula)

View File

@ -15,7 +15,7 @@
<script src="../_static/doctools.js"></script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="Data" href="calc_data.html" />
<link rel="next" title="Manipulate ranges" href="calc_ranges2.html" />
<link rel="prev" title="Sheets" href="calc_sheets.html" />
<link rel="stylesheet" href="../_static/custom.css" type="text/css" />
@ -263,7 +263,7 @@
<li><a href="easymacro.html">Library easymacro.py</a><ul>
<li><a href="calc.html">Calc</a><ul>
<li>Previous: <a href="calc_sheets.html" title="previous chapter">Sheets</a></li>
<li>Next: <a href="calc_data.html" title="next chapter">Data</a></li>
<li>Next: <a href="calc_ranges2.html" title="next chapter">Manipulate ranges</a></li>
</ul></li>
</ul></li>
</ul></li>

View File

@ -15,7 +15,7 @@
<script src="../_static/doctools.js"></script>
<link rel="index" title="Index" href="../genindex.html" />
<link rel="search" title="Search" href="../search.html" />
<link rel="next" title="Data" href="calc_data.html" />
<link rel="next" title="Cell and ranges" href="calc_ranges.html" />
<link rel="prev" title="Document" href="calc_doc.html" />
<link rel="stylesheet" href="../_static/custom.css" type="text/css" />
@ -174,13 +174,13 @@
<li><p>By object</p></li>
</ul>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">sheet</span> <span class="o">=</span> <span class="n">doc</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span>
<span class="n">doc</span><span class="o">.</span><span class="n">copy</span><span class="p">(</span><span class="n">sheet</span><span class="p">,</span> <span class="s1">&#39;OtherSheet&#39;</span><span class="p">)</span>
<span class="n">doc</span><span class="o">.</span><span class="n">copy_sheet</span><span class="p">(</span><span class="n">sheet</span><span class="p">,</span> <span class="s1">&#39;OtherSheet&#39;</span><span class="p">)</span>
</pre></div>
</div>
<ul class="simple">
<li><p>By name</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">copy</span><span class="p">(</span><span class="s1">&#39;Sheet1&#39;</span><span class="p">,</span> <span class="s1">&#39;Sheet2&#39;</span><span class="p">)</span>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">doc</span><span class="o">.</span><span class="n">copy_sheet</span><span class="p">(</span><span class="s1">&#39;Sheet1&#39;</span><span class="p">,</span> <span class="s1">&#39;Sheet2&#39;</span><span class="p">)</span>
</pre></div>
</div>
<ul class="simple">
@ -379,7 +379,7 @@
<li><a href="easymacro.html">Library easymacro.py</a><ul>
<li><a href="calc.html">Calc</a><ul>
<li>Previous: <a href="calc_doc.html" title="previous chapter">Document</a></li>
<li>Next: <a href="calc_data.html" title="next chapter">Data</a></li>
<li>Next: <a href="calc_ranges.html" title="next chapter">Cell and ranges</a></li>
</ul></li>
</ul></li>
</ul></li>

View File

@ -46,10 +46,13 @@
</li>
<li class="toctree-l1"><a class="reference internal" href="examples_calc.html">For Calc</a><ul>
<li class="toctree-l2"><a class="reference internal" href="examples_calc.html#data-to-cell">Data to cell</a></li>
<li class="toctree-l2"><a class="reference internal" href="examples_calc.html#copy-visible-cells">Copy visible cells</a></li>
<li class="toctree-l2"><a class="reference internal" href="examples_calc.html#merge-by-row">Merge by row</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="examples_writer.html">For Writer</a><ul>
<li class="toctree-l2"><a class="reference internal" href="examples_writer.html#set-autostyle-in-table">Set autostyle in table</a></li>
<li class="toctree-l2"><a class="reference internal" href="examples_writer.html#insert-math-formula">Insert math formula</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="examples_draw.html">For Draw</a><ul>
@ -96,6 +99,7 @@
<li class="toctree-l2"><a class="reference internal" href="examples_base.html">For Base</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="apendixes.html">Apendixes</a></li>
</ul>
<div class="relations">

View File

@ -53,6 +53,25 @@
</pre></div>
</div>
</section>
<section id="copy-visible-cells">
<h2>Copy visible cells<a class="headerlink" href="#copy-visible-cells" 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">active</span>
<span class="n">rangos</span> <span class="o">=</span> <span class="n">doc</span><span class="o">.</span><span class="n">active</span><span class="p">[</span><span class="s1">&#39;A1&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">current_region</span><span class="o">.</span><span class="n">visible</span>
<span class="n">doc</span><span class="o">.</span><span class="n">select</span><span class="p">(</span><span class="n">rangos</span><span class="p">)</span>
<span class="n">doc</span><span class="o">.</span><span class="n">copy</span><span class="p">()</span>
<span class="n">doc</span><span class="o">.</span><span class="n">active</span><span class="p">[</span><span class="s1">&#39;A15&#39;</span><span class="p">]</span><span class="o">.</span><span class="n">select</span><span class="p">()</span>
<span class="n">doc</span><span class="o">.</span><span class="n">paste</span><span class="p">()</span>
</pre></div>
</div>
</section>
<section id="merge-by-row">
<h2>Merge by row<a class="headerlink" href="#merge-by-row" title="Permalink to this headline"></a></h2>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">rango</span> <span class="o">=</span> <span class="n">app</span><span class="o">.</span><span class="n">selection</span>
<span class="n">rango</span><span class="o">.</span><span class="n">merge_by_row</span><span class="p">()</span>
</pre></div>
</div>
</section>
</section>
@ -85,6 +104,7 @@
<li class="toctree-l2"><a class="reference internal" href="examples_base.html">For Base</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="apendixes.html">Apendixes</a></li>
</ul>
<div class="relations">

View File

@ -45,6 +45,14 @@
</pre></div>
</div>
</section>
<section id="insert-math-formula">
<h2>Insert math formula<a class="headerlink" href="#insert-math-formula" title="Permalink to this headline"></a></h2>
<div class="highlight-python notranslate"><div class="highlight"><pre><span></span><span class="n">formula</span> <span class="o">=</span> <span class="s1">&#39;%LAMBDA_{deg&quot;,&quot;t}=1 + </span><span class="si">%a</span><span class="s1">lpha_deg SQRT {M_t over M_{(t=0)}-1}~&quot;.&quot;&#39;</span>
<span class="n">text</span> <span class="o">=</span> <span class="n">app</span><span class="o">.</span><span class="n">selection</span>
<span class="n">text</span><span class="o">.</span><span class="n">insert_math</span><span class="p">(</span><span class="n">formula</span><span class="p">)</span>
</pre></div>
</div>
</section>
</section>
@ -77,6 +85,7 @@
<li class="toctree-l2"><a class="reference internal" href="examples_base.html">For Base</a></li>
</ul>
</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

@ -36,3 +36,12 @@ Copy visible cells
doc.active['A15'].select()
doc.paste()
Merge by row
^^^^^^^^^^^^
.. code-block:: python
rango = app.selection
rango.merge_by_row()