@@ -458,31 +458,19 @@ def _(
458458 msg = "Tables with multiple header rows are not supported."
459459 raise ValueError (msg )
460460
461- n_rows = len (table_structure .header_rows ) + len (
462- table_structure .body_rows
463- )
461+ rows = [* table_structure .header_rows , * table_structure .body_rows ]
464462 table = UnoTable (
465- n_rows = n_rows ,
463+ n_rows = len ( rows ) ,
466464 n_cols = table_structure .n_cols ,
467465 header_row = bool (table_structure .header_rows ),
468466 )
469467
470- row_idx = 0
471- for header_row in table_structure .header_rows :
472- for col_idx , entry in enumerate (iterable = header_row .children ):
473- source = _cell_source_node (entry = entry )
474- table [row_idx , col_idx ] = _create_rich_text_from_children (
475- node = source
476- )
477- row_idx += 1
478-
479- for body_row in table_structure .body_rows :
480- for col_idx , entry in enumerate (iterable = body_row .children ):
468+ for row_index , row in enumerate (iterable = rows ):
469+ for column_index , entry in enumerate (iterable = row .children ):
481470 source = _cell_source_node (entry = entry )
482- table [row_idx , col_idx ] = _create_rich_text_from_children (
483- node = source
471+ table [row_index , column_index ] = (
472+ _create_rich_text_from_children ( node = source )
484473 )
485- row_idx += 1
486474
487475 self ._add_block_to_tree (block = table , parent_path = parent_path )
488476
0 commit comments