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 2db00bc commit a06a0f5
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 6 deletions.
29 changes: 28 additions & 1 deletion docs/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ Aside from a few general methods, initial efforts have been on enhancing the spr

This guide is not intended to be an OpenOffice UNO tutorial but is for developers familiar with the concepts to showcase the advantages of Apache Groovy + UNO.

This documentation's AsciiDoc source is maintained in the docs folder of the https://github.com/cbmarcum/guno-extension[GUNO-Extension Project] on GitHub.

== Getting the Extension
Projects that build using dependencies from artifact repositories like Apache Maven, JCenter, etc. just need to include
the latest version as a dependency in the build file or POM.
Expand Down Expand Up @@ -173,7 +175,7 @@ xCellProps["CellStyle"] = "Result"

See below for an even faster method to set Cell Properties.

=== Spreadsheet Index and Cells
=== 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 example leaves out the try/catch for brevity and assumes we have a reference to XSpreadsheetDocument _myDoc_
Expand All @@ -194,6 +196,31 @@ XSpreadsheet xSheet = myDoc.getSheetByIndex(0)

From this point on, the examples are Groovy without and then with the GUNO Extension.

=== Cell Contents

The GUNO Extension adds getters and setters for cell Formulas (text) and Values (numeric) to XCellRange. This allows you to get or set the contents of a cell by it's position in a XCellRange, XSheetCellRange, or XSpreadsheet depending on which Interface you use. +
The methods are: +
_String getFormulaOfCell(int column, int row)_ +
_void setFormulaOfCell(int column, int row, String value)_ +
_Double getValueOfCell(int column, int row)_ +
_void setValueOfCell(int column, int row, float value)_


*Without Extension* (assumes we have an xSpreadsheet reference)
[source, groovy]
----
XCellRange xCellRange = UnoRuntime.queryInterface(XCellRange.class, xSpreadsheet)
xCell = xCellRange.getCellByPosition(2,2)
XText xCellText = UnoRuntime.queryInterface(XText.class, xCell)
xCellText.setString("Quotation")
----

*With Extension*
[source, groovy]
----
xSpreadsheet.setFormulaOfCell(2,2, "Quotation")
----

=== Setting the Cell Style property

The extension adds a setter method for CellStyle allowing what looks like property access to cellStyle. (ToDo add getter method)
Expand Down
40 changes: 37 additions & 3 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,8 @@ <h1>GUNO Extension Documentation</h1>
<li><a href="#trueget-an-xcomponentloader">Get an XComponentLoader</a></li>
<li><a href="#trueunoruntime-queryinterface">UnoRuntime.queryInterface</a></li>
<li><a href="#trueproperty-access">Property Access</a></li>
<li><a href="#truespreadsheet-index-and-cells">Spreadsheet Index and Cells</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="#truesetting-the-active-sheet">Setting The Active Sheet</a></li>
Expand Down Expand Up @@ -497,6 +498,9 @@ <h2 id="trueintroduction"><a class="anchor" href="#trueintroduction"></a>Introdu
<div class="paragraph">
<p>This guide is not intended to be an OpenOffice UNO tutorial but is for developers familiar with the concepts to showcase the advantages of Apache Groovy + UNO.</p>
</div>
<div class="paragraph">
<p>This documentation&#8217;s AsciiDoc source is maintained in the docs folder of the <a href="https://github.com/cbmarcum/guno-extension">GUNO-Extension Project</a> on GitHub.</p>
</div>
</div>
</div>
<div class="sect1">
Expand Down Expand Up @@ -723,7 +727,7 @@ <h3 id="trueproperty-access"><a class="anchor" href="#trueproperty-access"></a>P
</div>
</div>
<div class="sect2">
<h3 id="truespreadsheet-index-and-cells"><a class="anchor" href="#truespreadsheet-index-and-cells"></a>Spreadsheet Index and Cells</h3>
<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>
</div>
Expand Down Expand Up @@ -753,6 +757,36 @@ <h3 id="truespreadsheet-index-and-cells"><a class="anchor" href="#truespreadshee
</div>
</div>
<div class="sect2">
<h3 id="truecell-contents"><a class="anchor" href="#truecell-contents"></a>Cell Contents</h3>
<div class="paragraph">
<p>The GUNO Extension adds getters and setters for cell Formulas (text) and Values (numeric) to XCellRange. This allows you to get or set the contents of a cell by it&#8217;s position in a XCellRange, XSheetCellRange, or XSpreadsheet depending on which Interface you use.<br>
The methods are:<br>
<em>String getFormulaOfCell(int column, int row)</em><br>
<em>void setFormulaOfCell(int column, int row, String value)</em><br>
<em>Double getValueOfCell(int column, int row)</em><br>
<em>void setValueOfCell(int column, int row, float value)</em></p>
</div>
<div class="paragraph">
<p><strong>Without Extension</strong> (assumes we have an xSpreadsheet reference)</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlightjs highlight"><code data-lang="groovy" class="language-groovy hljs">XCellRange xCellRange = UnoRuntime.queryInterface(XCellRange.class, xSpreadsheet)
xCell = xCellRange.getCellByPosition(2,2)
XText xCellText = UnoRuntime.queryInterface(XText.class, xCell)
xCellText.setString("Quotation")</code></pre>
</div>
</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">xSpreadsheet.setFormulaOfCell(2,2, "Quotation")</code></pre>
</div>
</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>
<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>
Expand Down Expand Up @@ -919,7 +953,7 @@ <h3 id="truerangecontainer"><a class="anchor" href="#truerangecontainer"></a>Ran
</div>
<div id="footer">
<div id="footer-text">
Last updated 2020-06-29 19:11:53 -0400
Last updated 2020-07-01 20:42:50 -0400
</div>
</div>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.15.6/styles/github.min.css">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ class SpreadsheetExtension {
* @param column zero based column position.
* @param row zero based row position.
* @param value the string value to insert.
* @deprecated As of release 4.1.6.1, replaced by {@link #getFormulaOfCell(final XCellRange self, int column, int row)}
* @deprecated As of release 4.1.6.1, replaced by {@link #setFormulaOfCell(final XCellRange self, int column, int row)}
*/
@Deprecated
static void insertFormulaIntoCell(final XSpreadsheet self, int column, int row, String value) {
Expand All @@ -183,7 +183,7 @@ class SpreadsheetExtension {
* @param column zero based column position.
* @param row zero based row position.
* @param value the float value to insert.
* @deprecated As of release 4.1.6.1, replaced by {@link #getValueOfCell(final XCellRange self, int column, int row)}
* @deprecated As of release 4.1.6.1, replaced by {@link #setValueOfCell(final XCellRange self, int column, int row)}
*/
@Deprecated
static void insertValueIntoCell(final XSpreadsheet self, int column, int row, float value) {
Expand Down

0 comments on commit a06a0f5

Please sign in to comment.