Hello Kurt,
Kurt Forrester wrote (3-4-2009 12:36)
Cor,
Thanks for your response. I have looked all over the openoffice wiki's
and mail groups and have had no luck hence my posting here. Without
wanting to cross post I will continue using this thread (I do not know
how to move a thread on a forum -> api dev).
Never mind. Now I just posted to that one.
I however don't think your
suggestion has addressed the issue that I am having. I wish to add a
caption to a table not format the leading row of the table. The caption
is a auto numbered field that increments relative to the preceding
tables in a document. Normally I can achieve this using the context menu
whilst in a table (menu item -> Caption...).
Sorry that I misunderstood your problem.
If I look at a caption of table in Writer, I see that
- paragraph style Table, which inherits from style Caption is applied;
- the line starts with the word "Table"
- has a field "Variable", type "Number range" and name "Table"
So if you do those steps by code, it will be the caption.
HTH,
Cor
I have implemented the code
as suggested by yourself and it does not fix the problem I am having.
Below is an example of what I am trying to achieve (Table X.Y to be
placed above the table). If you or anybody else has any further
suggestions I would be greatly appreciative.
Kind Regards,
Kurt
Table X.Y : This is the text associated with the caption
--------------------------------------------------------
| A1 | B1 |
--------------------------------------------------------
| A2 | B2 |
--------------------------------------------------------
-----Original Message-----
*From*: Cor Nouws <[email protected]
*To*: [email protected] <mailto:[email protected]>
Hi Kurt,
Kurt Forrester wrote (3-4-2009 7:26)
I am trying to code a Basic script to insert a formatted table into an
existing opened writer document with a caption above the newly inserted
table. I have managed to insert the table and format it as I wish
however I cannot seem to find the method to insert a caption for the
table. Could anybody please point me in the direction of how this is
achieved?
You need the texCursor of the cell(s) in the top row of the table and
set the needed paragraph style there.
oCrs = oTable.getCellByPosition(x, y).createTextCursor()
oCrs.paraStyleName = "Table Heading"
Kindest regards,
Cor
ps: a question like this can best be asked on dev at api.openoffice.org
And when you subscribe first, you won't miss any answers.
To do so, mail to [email protected]
<mailto:[email protected]>
Have you also looked at the api home page ?
http://api.openoffice.org/ There you'll find a link to lot of info, and
the wiki etc.
--
Cor Nouws - nl.OpenOffice.org marketing contact
= "2009 - Develop OOo" = www.nieuwsteoffice.nl =
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]