[Solved] Copy rows with Java

Java, C++, C#, Delphi... - Using the UNO bridges
Post Reply
lisa_florian
Posts: 4
Joined: Tue Apr 10, 2012 8:57 am

[Solved] Copy rows with Java

Post by lisa_florian »

Hi,

my task is to fill an existing Calc file with content from a database. The problem is, that i need to copy the style of the cells to the next line. If the first cell has red text, the next row should have red text too. Because I don't know what exactly is changed, I need to copy all properties. I made this work, but it takes far too long. This copying needs about 150 ms per cell. As there are about 50 cells in a row, thats about 8 seconds per row. If I've got 100 rows thats about 1.5 minutes. Is there a way to make that faster? In Excel we always copy a complete row, not each cell and each property. Is there a similar solution for OOo? Or is there a way to set the whole XPropertySet of the new cell to the XPropertySet of the old cell?

Here is a part of my code:

Code: Select all

for (Property p : oldproperties){
       try {
              newPropSet.setPropertyValue(p.Name, oldPropSet.getPropertyValue(p.Name));
         } catch [...]                
}

Edit: Just found a solution. If you have the same problem, look here: http://wiki.services.openoffice.org/wik ... preadsheet
I use OOo 3.2.1 on Windows.
Post Reply