OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

state of the art in copying cell format - into joined cells?

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API
View previous topic :: View next topic  
Author Message
amtho
General User
General User


Joined: 03 Oct 2006
Posts: 10
Location: Chapel Hill, NC, United States of America

PostPosted: Wed Oct 11, 2006 4:52 pm    Post subject: state of the art in copying cell format - into joined cells? Reply with quote

I found this nice and helpful thread: http://www.oooforum.org/forum/viewtopic.phtml?t=18380&highlight=paste+special

... as well as a few others which seem to indicate that the most direct way to copy the formattng from one cell to another is to emulate, in code, the menu command "Paste Special".

However, I want to copy from a single cell to a joined cell (made up of four cells that have been joined). Is there a way to do this? When I use the "Copy" and "Paste Special" commands from the menu, OpenOffice splits my joined cells. This is 2.0.3.

Thanks in advance!
Back to top
View user's profile Send private message
noranthon
Super User
Super User


Joined: 07 Jul 2005
Posts: 3318

PostPosted: Wed Oct 11, 2006 9:47 pm    Post subject: Reply with quote

To my surprise, you can use oTarget.setDataArray( oSource.getDataArray ) in both directions.

You can copy from the merged cells to the single cell and vice versa. It works with .getCellRangeByPosition, getCellByPosition and .getCellRangeByName.

When naming the target in your case, use the first of the merged cells.
_________________
search forum by month
Back to top
View user's profile Send private message
amtho
General User
General User


Joined: 03 Oct 2006
Posts: 10
Location: Chapel Hill, NC, United States of America

PostPosted: Sat Oct 14, 2006 3:54 pm    Post subject: still working Reply with quote

Sorry I haven't replied yet -- I tried this really quickly the other day but didn't get it to work yet; I want to work with it a bit more before replying though - I was doing a lot at once and could have confused it somehow. I hope to work on it some more soon.
Back to top
View user's profile Send private message
amtho
General User
General User


Joined: 03 Oct 2006
Posts: 10
Location: Chapel Hill, NC, United States of America

PostPosted: Sun Oct 15, 2006 8:22 am    Post subject: copyies data, but not format Reply with quote

Hi there,

I think my question may not have been clear. Get/SetDataArray does indeed work, for copying data, but I'm not getting any formatting (font, bold/italics/color, cell background color). I am using a cell rather than a range - could this be a factor?

I was able to copy the values/formulas of the cells just by using the value or formula properites; but the crux is actually that I'd like the formatting, too.

Thanks!
Back to top
View user's profile Send private message
Danad
OOo Advocate
OOo Advocate


Joined: 22 Feb 2004
Posts: 293
Location: Brasil

PostPosted: Sun Oct 15, 2006 3:58 pm    Post subject: Reply with quote

Hi !

If your source and target are into same document, you can use the method copyRange of interface XCellRangeMovement.

If not (are in != documents) you can use XAreaLink, see:
http://www.oooforum.org/forum/viewtopic.phtml?t=35459

HTH
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Macros and API All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group