And what about when the user open a new template twice, but not export any PDF? It need to increase the number or not?
If that happens its should not increase by one until it is exported by pdf.
You can have two open on accident or not but it would not increase the # until its exported.
The way i have planned it out in my head was i created a macro and bind it to a event. The only problem I run into is that the template doesnt save that value for the next time to keep added onto the (invoice cell value)
Dim oSheet as Object
oSheet = ThisComponent.getSheets().getByIndex(0)
oSheet.getCellRangeByName("F2").setValue(oSheet.getCellRangeByName("F2").getValue() + 1)
Is the counter spreadsheet same as the invoice template, or is there a standalone “bookkeeping” spreadsheet for the counter and other data to register about the invoices?
The Counter is keep track of invoices that as been created and to have a unique but sequential number for each invoice.