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). 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...). 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]
Cc: [email protected]
Subject: Re: [dev] Basic insert caption openoffice
Date: Fri, 03 Apr 2009 10:59:54 +0200


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]

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.

  • [dev] Basic ... Kurt Forrester
    • Re: [de... Cor Nouws
      • Re:... Kurt Forrester
        • ... Oliver-Rainer Wittmann - Software Engineer - Sun Microsystems

Reply via email to