The addin should find the area in which the sheet is filled.
This thing will be used for educational use. So it should help
People who don't have much experience with calc. The specify the
Starting cell and use the function to access the area. So the can
Add data to the range without caring about the address.
I'm doing this for a teacher ...
He has written this for Excel. Where it looks like this (Basic-Code):
Public Function CSDRightFrom(startcell As Range) As Range
Set CSDRightFrom = Range(startcell, startcell.End(xlToRight))
End Function
Public Function CSDRangeAddress(arg As Range) As String
CSDRangeAddress = arg.Address
End Function
To use it he calls
CSDRangeAddress(CSDRightFrom(A1))
In that AddOn there are some functions which are reading cell ranges.
Thanks for your time,
Martin
-----Ursprüngliche Nachricht-----
Von: Ariel Constenla-Haile [mailto:[email protected]]
Gesendet: Sonntag, 23. Mai 2010 21:35
An: [email protected]
Betreff: Re: [api-dev] java-macro: Not able to access CurrentComponent?
Hello Martin,
On Sunday 23 May 2010, 15:17, Martin Dobiasch wrote:
> What my code should be: AddOn and AddIn as the extension im working on
> needs both. One way to avoid this would be to have the addin replaced by
> some Basic-Code. Is this possible?
an Add-In (written in any language that can implement UNO components)
provides
new functions that can be used in OOo Calc cells just like any other
built-in
function.
OOo Calc can also look for functions written in OOo Basic, placed in OOo
Basic
Standard libraries, but not in Basic libraries provided by extensions.
So, if you want your extension to provide new functions to OOo Calc, you
must
implement an OOo Calc Add-In.
If you also want to implement an Add-On, you can do both things in the same
extension, even in the same JAR file: design a Java class for the component
implementing the ProtocolHandler, and another one for the Calc Add-in
component; that is 2 UNO components in one JAR file.
This is possible and good practice (IMHO implementing both the Add-In and
the
ProtocolHandler in the same component is no good idea: both components need
to
have their own lifetime cycle, are instantiated by different
implementations,
etc.)
> My Problem within the addin: I need access to the SpreadsheetDocument or
> access to one specific sheet (specified by name).
access to one spreadsheet is no good practice for an Add-In: it only
provides
a function that can take some parameters and return values.
Why do you need access to one sheet? Please explain, there may be another
solution for your use case.
If you want the result to appear in a specific sheet, it is the user who
has
to put the result returned by your function on that specific sheet, just
like
s/he does with built-in functions.
If you want to read data from a specific sheet, it is also up to the user to
send the data as parameter to your function.
> I've added as you suggested XPropertySet as Parameter. The documentation
> Says its an interface to the SpreadsheetDocument.
the XPropertySet is there just in case your Add-In function needs to query
some specific settings (like the locale, or formatting settings), but IMHO
is
no good practice to modify the document.
Your Add-In function is just a function that processes the data it receives
and returns some values.
Even modifying the css.table.XCellRange the function can receive may be
questionable.
> But how do I query for it?
just like you do with any other object in OOo API Java language binding: use
UnoRuntime.queryInterface and check if the returned object is not null.
But my advice is not to modify the XSpreadsheetDocument from within the Add-
In. Use XPropertySet just to query for settings.
There may be some other solution that satisfies your needs.
Regards
--
Ariel Constenla-Haile
La Plata, Argentina
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]