I think I just found a bug
Look at this code
def generate_order(pathname, order):
from ooodev.loader.lo import Lo
from ooodev.write.write_doc import WriteDoc
loader = Lo.load_office(Lo.ConnectSocket(
headless=True,
))
doc = WriteDoc.open_doc(fnm=pathname, loader=loader)
#Inizio a rimpiazzare tutte le stringhe con i dati
try:
replace(doc, "&FORNITORE", order.supplier.legal_name)
replace(doc, "&INDIRIZZO", order.supplier.get_legal_address().address)
replace(doc, "&LOCALITA", order.supplier.get_legal_address().city_address)
replace(doc, "&PROTOCOLLO", order.protocol)
replace(doc, "&DATAORDINE", utilities.format_date(order.order_date))
#Valorizzo tabella dettagli
table = doc.tables.get_by_index(2)
for detail in order.to_details.all():
new_row = table.rows.append_row()
new_row["A1"].value = detail.material.description
new_row["B1"].value = 'PROVA'
It works well, but if I change cell indexing mode to integers
new_row[0].value = detail.material.description
new_row[1].value = 'PROVA'
I get a list index out of bound exception on the [1] indexed row
The table in my document has 5 colums
I think I just found a bug
Look at this code
It works well, but if I change cell indexing mode to integers
I get a list index out of bound exception on the [1] indexed row
The table in my document has 5 colums