Skip to content

Commit

Permalink
Refs #3 - doc update.
Browse files Browse the repository at this point in the history
  • Loading branch information
cbmarcum committed Jul 2, 2020
1 parent 4feee34 commit 0d9f355
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 32 deletions.
50 changes: 35 additions & 15 deletions docs/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ Projects that build using dependencies from artifact repositories like Apache Ma
the latest version as a dependency in the build file or POM.

=== Gradle Projects
[source, groovy]
[source, gradle]
----
compile group: 'net.codebuilders', name: 'guno-extension', version: '4.1.6.12'
compile group: 'net.codebuilders', name: 'guno-extension', version: '4.1.6.13'
----

=== Maven Projects
Expand All @@ -34,7 +34,7 @@ compile group: 'net.codebuilders', name: 'guno-extension', version: '4.1.6.12'
<dependency>
<groupId>net.codebuilders</groupId>
<artifactId>guno-extension</artifactId>
<version>4.1.6.12</version>
<version>4.1.6.13</version>
</dependency>
----

Expand All @@ -43,7 +43,7 @@ Groovy scripts can declare a Grab dependency at the beginning before import stat
[source, groovy]
----
@Grapes(
@Grab(group='net.codebuilders', module='guno-extension', version='4.1.6.12')
@Grab(group='net.codebuilders', module='guno-extension', version='4.1.6.13')
)
----

Expand Down Expand Up @@ -144,13 +144,15 @@ xSheet = oIndexSheets.getByIndex(0).guno(XSpreadsheet.class)
An UNO object must offer its properties through interfaces that allow you to work with properties. The most basic form
of these interfaces is the interface com.sun.star.beans.XPropertySet .

In XPropertySet, two methods carry out the property access, _getPropertyValue(String propertyName)_ and
_setPropertyValue(String propertyName, Object propertyValue)_.
In XPropertySet, two methods carry out the property access: +
_Object getPropertyValue(String propertyName)_ +
_void setPropertyValue(String propertyName, Object propertyValue)_ +

The GUNO Extension adds the methods _getAt(String propertyName)_ and _putAt(String propertyName, Object propertyValue)_
to the XPropertySet class.
The GUNO Extension adds two special methods to XPropertySet: +
_Object getAt(String propertyName)_ +
_void putAt(String propertyName, Object propertyValue)_ +

Example: Set the CellStyle of a spreadsheet Cell *xCell*.
Example: Set the CellStyle of a spreadsheet Cell _xCell_.

*Java*
[source,java]
Expand All @@ -166,8 +168,9 @@ XPropertySet xCellProps = xCell.guno(XPropertySet.class)
xCellProps.putAt("CellStyle", "Result")
----

By adding _getAt()_ and _putAt()_ methods to XPropertySet we can now access the properties using http://groovy-lang.org/operators.html#subscript-operator[Groovy Subscript Operator] notation. This can Get or Set properties depending on which side of the assigment it's on.
These special methods allow a shorthand version to getAt and PutAt using http://groovy-lang.org/operators.html#subscript-operator[Groovy Subscript Operator] notation. This can Get or Set properties depending on which side of the assigment it's on.

*GUNO Extension* using Subscript operator for assignment.
[source,groovy]
----
xCellProps["CellStyle"] = "Result"
Expand All @@ -176,7 +179,10 @@ xCellProps["CellStyle"] = "Result"
See below for an even faster method to set Cell Properties.

=== Spreadsheet By Index and Name
The GUNO Extension adds a _getSheetByIndex(Integer nIndex)_ method to XSpreadsheetDocument that returns the XSpreadsheet by the index position saving the steps of getting the XIndexAccess enumeration of sheets and then getting the sheet by index. Likewise there is a _getSheetByName(String name)_ method added also.
The GUNO Extension adds a method to XSpreadsheetDocument that returns the XSpreadsheet by the index position saving the steps of getting the XIndexAccess enumeration of sheets and then getting the sheet by index. Likewise there is a method that uses the sheet name. +
_XSpreadsheet getSheetByIndex(Integer nIndex)_ +
_XSpreadsheet getSheetByName(String name)_


The example leaves out the try/catch for brevity and assumes we have a reference to XSpreadsheetDocument _myDoc_

Expand Down Expand Up @@ -221,9 +227,13 @@ xCellText.setString("Quotation")
xSpreadsheet.setFormulaOfCell(2,2, "Quotation")
----

=== Setting the Cell Style property
=== Cell Style

The extension adds a setter method for CellStyle allowing what looks like property access to cellStyle. (ToDo add getter method)
The extension adds getter and setter methods for CellStyle to XCell +
_Object getCellStyle()_ +
_void setCellStyle(Object value)_ +
allowing what looks like property access to the CellStyle property. +
To set the cell style to "Result":

*Without Extension*

Expand All @@ -239,9 +249,19 @@ xCellProps.setPropertyValue("CellStyle", "Result")
xCell.cellStyle = "Result"
----

=== Using Enum Types
To get the style as a String:

*With Extension*
[source, groovy]
----
String style = xCell.cellStyle
----

=== CellVertJustify Enum

The extension adds getter and setter methods for CellVertJustify allowing what looks like property access to vertJustify.
The extension adds getter and setter methods to XCell allowing what looks like property access to vertJustify and use the CellVertJustify enum types.
_Integer getVertJustify()_ +
_void setVertJustify(Object value)_

*Without Extension*

Expand Down
58 changes: 41 additions & 17 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -465,8 +465,8 @@ <h1>GUNO Extension Documentation</h1>
<li><a href="#trueproperty-access">Property Access</a></li>
<li><a href="#truespreadsheet-by-index-and-name">Spreadsheet By Index and Name</a></li>
<li><a href="#truecell-contents">Cell Contents</a></li>
<li><a href="#truesetting-the-cell-style-property">Setting the Cell Style property</a></li>
<li><a href="#trueusing-enum-types">Using Enum Types</a></li>
<li><a href="#truecell-style">Cell Style</a></li>
<li><a href="#truecellvertjustify-enum">CellVertJustify Enum</a></li>
<li><a href="#truesetting-the-active-sheet">Setting The Active Sheet</a></li>
<li><a href="#trueget-cell-ranges">Get Cell Ranges</a></li>
<li><a href="#trueuse-of-xenumerationaccess">Use of XEnumerationAccess</a></li>
Expand Down Expand Up @@ -514,7 +514,7 @@ <h2 id="truegetting-the-extension"><a class="anchor" href="#truegetting-the-exte
<h3 id="truegradle-projects"><a class="anchor" href="#truegradle-projects"></a>Gradle Projects</h3>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="groovy" class="language-groovy hljs">compile group: 'net.codebuilders', name: 'guno-extension', version: '4.1.6.12'</code></pre>
<pre class="highlightjs highlight"><code data-lang="gradle" class="language-gradle hljs">compile group: 'net.codebuilders', name: 'guno-extension', version: '4.1.6.13'</code></pre>
</div>
</div>
</div>
Expand All @@ -525,7 +525,7 @@ <h3 id="truemaven-projects"><a class="anchor" href="#truemaven-projects"></a>Mav
<pre class="highlightjs highlight"><code data-lang="xml" class="language-xml hljs">&lt;dependency&gt;
&lt;groupId&gt;net.codebuilders&lt;/groupId&gt;
&lt;artifactId&gt;guno-extension&lt;/artifactId&gt;
&lt;version&gt;4.1.6.12&lt;/version&gt;
&lt;version&gt;4.1.6.13&lt;/version&gt;
&lt;/dependency&gt;</code></pre>
</div>
</div>
Expand All @@ -538,7 +538,7 @@ <h3 id="truegroovy-scripts"><a class="anchor" href="#truegroovy-scripts"></a>Gro
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="groovy" class="language-groovy hljs">@Grapes(
@Grab(group='net.codebuilders', module='guno-extension', version='4.1.6.12')
@Grab(group='net.codebuilders', module='guno-extension', version='4.1.6.13')
)</code></pre>
</div>
</div>
Expand Down Expand Up @@ -686,15 +686,17 @@ <h3 id="trueproperty-access"><a class="anchor" href="#trueproperty-access"></a>P
of these interfaces is the interface com.sun.star.beans.XPropertySet .</p>
</div>
<div class="paragraph">
<p>In XPropertySet, two methods carry out the property access, <em>getPropertyValue(String propertyName)</em> and
<em>setPropertyValue(String propertyName, Object propertyValue)</em>.</p>
<p>In XPropertySet, two methods carry out the property access:<br>
<em>Object getPropertyValue(String propertyName)</em><br>
<em>void setPropertyValue(String propertyName, Object propertyValue)</em><br></p>
</div>
<div class="paragraph">
<p>The GUNO Extension adds the methods <em>getAt(String propertyName)</em> and <em>putAt(String propertyName, Object propertyValue)</em>
to the XPropertySet class.</p>
<p>The GUNO Extension adds two special methods to XPropertySet:<br>
<em>Object getAt(String propertyName)</em><br>
<em>void putAt(String propertyName, Object propertyValue)</em><br></p>
</div>
<div class="paragraph">
<p>Example: Set the CellStyle of a spreadsheet Cell <strong>xCell</strong>.</p>
<p>Example: Set the CellStyle of a spreadsheet Cell <em>xCell</em>.</p>
</div>
<div class="paragraph">
<p><strong>Java</strong></p>
Expand All @@ -715,7 +717,10 @@ <h3 id="trueproperty-access"><a class="anchor" href="#trueproperty-access"></a>P
</div>
</div>
<div class="paragraph">
<p>By adding <em>getAt()</em> and <em>putAt()</em> methods to XPropertySet we can now access the properties using <a href="http://groovy-lang.org/operators.html#subscript-operator">Groovy Subscript Operator</a> notation. This can Get or Set properties depending on which side of the assigment it&#8217;s on.</p>
<p>These special methods allow a shorthand version to getAt and PutAt using <a href="http://groovy-lang.org/operators.html#subscript-operator">Groovy Subscript Operator</a> notation. This can Get or Set properties depending on which side of the assigment it&#8217;s on.</p>
</div>
<div class="paragraph">
<p><strong>GUNO Extension</strong> using Subscript operator for assignment.</p>
</div>
<div class="listingblock">
<div class="content">
Expand All @@ -729,7 +734,9 @@ <h3 id="trueproperty-access"><a class="anchor" href="#trueproperty-access"></a>P
<div class="sect2">
<h3 id="truespreadsheet-by-index-and-name"><a class="anchor" href="#truespreadsheet-by-index-and-name"></a>Spreadsheet By Index and Name</h3>
<div class="paragraph">
<p>The GUNO Extension adds a <em>getSheetByIndex(Integer nIndex)</em> method to XSpreadsheetDocument that returns the XSpreadsheet by the index position saving the steps of getting the XIndexAccess enumeration of sheets and then getting the sheet by index. Likewise there is a <em>getSheetByName(String name)</em> method added also.</p>
<p>The GUNO Extension adds a method to XSpreadsheetDocument that returns the XSpreadsheet by the index position saving the steps of getting the XIndexAccess enumeration of sheets and then getting the sheet by index. Likewise there is a method that uses the sheet name.<br>
<em>XSpreadsheet getSheetByIndex(Integer nIndex)</em><br>
<em>XSpreadsheet getSheetByName(String name)</em></p>
</div>
<div class="paragraph">
<p>The example leaves out the try/catch for brevity and assumes we have a reference to XSpreadsheetDocument <em>myDoc</em></p>
Expand Down Expand Up @@ -787,9 +794,13 @@ <h3 id="truecell-contents"><a class="anchor" href="#truecell-contents"></a>Cell
</div>
</div>
<div class="sect2">
<h3 id="truesetting-the-cell-style-property"><a class="anchor" href="#truesetting-the-cell-style-property"></a>Setting the Cell Style property</h3>
<h3 id="truecell-style"><a class="anchor" href="#truecell-style"></a>Cell Style</h3>
<div class="paragraph">
<p>The extension adds a setter method for CellStyle allowing what looks like property access to cellStyle. (ToDo add getter method)</p>
<p>The extension adds getter and setter methods for CellStyle to XCell<br>
<em>Object getCellStyle()</em><br>
<em>void setCellStyle(Object value)</em><br>
allowing what looks like property access to the CellStyle property.<br>
To set the cell style to "Result":</p>
</div>
<div class="paragraph">
<p><strong>Without Extension</strong></p>
Expand All @@ -808,11 +819,24 @@ <h3 id="truesetting-the-cell-style-property"><a class="anchor" href="#truesettin
<pre class="highlightjs highlight"><code data-lang="java" class="language-java hljs">xCell.cellStyle = "Result"</code></pre>
</div>
</div>
<div class="paragraph">
<p>To get the style as a String:</p>
</div>
<div class="paragraph">
<p><strong>With Extension</strong></p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="groovy" class="language-groovy hljs">String style = xCell.cellStyle</code></pre>
</div>
</div>
</div>
<div class="sect2">
<h3 id="trueusing-enum-types"><a class="anchor" href="#trueusing-enum-types"></a>Using Enum Types</h3>
<h3 id="truecellvertjustify-enum"><a class="anchor" href="#truecellvertjustify-enum"></a>CellVertJustify Enum</h3>
<div class="paragraph">
<p>The extension adds getter and setter methods for CellVertJustify allowing what looks like property access to vertJustify.</p>
<p>The extension adds getter and setter methods to XCell allowing what looks like property access to vertJustify and use the CellVertJustify enum types.
<em>Integer getVertJustify()</em><br>
<em>void setVertJustify(Object value)</em></p>
</div>
<div class="paragraph">
<p><strong>Without Extension</strong></p>
Expand Down Expand Up @@ -953,7 +977,7 @@ <h3 id="truerangecontainer"><a class="anchor" href="#truerangecontainer"></a>Ran
</div>
<div id="footer">
<div id="footer-text">
Last updated 2020-07-01 20:42:50 -0400
Last updated 2020-07-02 11:45:56 -0400
</div>
</div>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.6/styles/github.min.css">
Expand Down

0 comments on commit 0d9f355

Please sign in to comment.