| View previous topic :: View next topic |
| Author |
Message |
amtho General User

Joined: 03 Oct 2006 Posts: 10 Location: Chapel Hill, NC, United States of America
|
Posted: Wed Oct 11, 2006 4:52 pm Post subject: state of the art in copying cell format - into joined cells? |
|
|
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 |
|
 |
noranthon Super User

Joined: 07 Jul 2005 Posts: 3318
|
Posted: Wed Oct 11, 2006 9:47 pm Post subject: |
|
|
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 |
|
 |
amtho General User

Joined: 03 Oct 2006 Posts: 10 Location: Chapel Hill, NC, United States of America
|
Posted: Sat Oct 14, 2006 3:54 pm Post subject: still working |
|
|
| 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 |
|
 |
amtho General User

Joined: 03 Oct 2006 Posts: 10 Location: Chapel Hill, NC, United States of America
|
Posted: Sun Oct 15, 2006 8:22 am Post subject: copyies data, but not format |
|
|
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 |
|
 |
Danad OOo Advocate

Joined: 22 Feb 2004 Posts: 293 Location: Brasil
|
Posted: Sun Oct 15, 2006 3:58 pm Post subject: |
|
|
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 |
|
 |
|