In diesem Artikel
The Accounting files content can be be modified using specific API functions.
Banana Accounting Extension can modify the data, but the user has full control of it:
- Changes to the file are first displayed to the user.
- The user must approve the changes.
- The user can undo the changes.
This approach put the user on full control. Once the changes are displayed, the user can decide whether to apply them or not. In addition, the user can also undo changes.
It's a different approach from Excel where scripts makes direct changes to the sheets and user cannot preview and undo them.
Extension for changing data
The process to change data is the following:
- The extension creates a DocumentChange JSON object that contains the information regarding the change:
- Add new rows with the possibility of also defining the style (colors, font size, ...).
- Modify existing rows with the possibility of also defining the style (colors, font size, ...).
- Delete rows.
- Modify File properties data.
- The exec() function of the extension returns the DocumentChange Object (see the Example of an Extension using a DocumentChange).
- When you run the extension, the program displays a dialog box where the user can see a preview of the data that will be changed.
Preview example where a new row is added to the Transactions table
- The user need to confirm the changes.
- The changes will be added to the undo/redo mechanism.
The user can therefore undo and redo the change, similar to all other commands. - The changes are applied to the accounting file.
The row with the style is added to the Transactions table