Hi Svante,

Thank you for your reply.  I'm finding it difficult to find out what I need to Google to follow the path you suggested below. Do you have some examples or web sites or books that you could recommend as a good starting point?

Thanks,

Andrew

On 2018-11-10 4:32 a.m., Svante Schubert wrote:
Hi Andrew,

likely Simple API has not implemented that feature, but Simple API relies
on ODFDOM and that uses W3C DOM, so you might consider to clone/copy the
previous table row.
Best is to take a look into the ODF XML to check if there are any IDs you
might need to adjust.

Have a nice weekend,
Svante

PS: I am personally using ODFDOM only, for instance currently I am
extracting table data from an EU specification to generate source code from.


Am Mi., 7. Nov. 2018 um 22:37 Uhr schrieb Andrew Willerding <
[email protected]>:

Hi,

I have an existing table that I am appending rows to and I want the new
rows to have the same font, alignment, etc as the rows previous to the
additions but I'm finding that the new rows appear in the default
document font style.

He's a snippet of code I've used to try to manipulate the cell fonts.

                             Cell cellItem =
newRow.getCellByIndex(cellIndex++);
                              cellItem.setStringValue(cell);
                              if (firstRow != null) {
                                  System.out.println("Cell=" +
firstRow.getCellByIndex(cellIndex - 1).getStringValue());
                                  // System.out.println("Cell=" +
firstRow.getCellByIndex(cellIndex -
1).getHorizontalAlignmentType().getAlignmentString());
                                  System.out.println("Cell=" +
firstRow.getCellByIndex(cellIndex - 1).getCellStyleName());
                                  System.out.println("Cell=" +
firstRow.getCellByIndex(cellIndex - 1).getStyleHandler());
                                 //
cellItem.setHorizontalAlignment(firstRow.getCellByIndex(cellIndex -
1).getHorizontalAlignmentType());
//cellItem.setFont(firstRow.getCellByIndex(cellIndex -1).getFont());
//cellItem.getFont().setSize(firstRow.getCellByIndex(cellIndex
-1).getFont().getSize() - 2);
cellItem.getStyleHandler().setFont(firstRow.getCellByIndex(cellIndex -
1).getStyleHandler().getFont(Document.ScriptType.WESTERN));
                                  //
cellItem.setCellStyleName(firstRow.getCellByIndex(cellIndex -
1).getCellStyleName());
                              }

Except for the actual value of the cell, what prints out with the
System.out statements is not the actual font, font size, etc of the cell.

Is this a bug or am I not accessing and setting the values correctly?
I've been referencing this web page for trying to get my code to work


https://incubator.apache.org/odftoolkit/simple/document/cookbook/Style%20Handling.html#Advanced%20font%20handling

Thanks,

Andrew

P.S.  This list is very quiet but I'm hoping someone is reading it from
time to time.


Reply via email to