Columns generated by code
In the Quick-Start Guide we show how to create a simple spreadsheet: Start Using Resolver One. At the end we mention that you can write code so that you don't have to copy the formula to calculate the Gross Price to every cell in column C. This sample, which is saved as Columns generated by code in the Samples subfolder of the Resolver One folder on your start menu, shows how to do that.
If you load it up, you will see that the grid looks precisely as it did in the earlier sample. However, if you double-click on the cells below "Gross Price" you will see that there is nothing there! How are the numbers being generated?
To see that, go down to the code and look at the "Pre-formulae user code" - the green section. In there you will see the following code:
for row in workbook["Sheet1"].ContentRows:
row["Gross Price"] = withVAT(row["Net Price"])
This is what is generating the values. Now, if you add a new item to the bottom of the list - try typing "Pencil" into A9 and "0.10" into B9 - the gross price will be automatically calculated and displayed.
Back to Sample Spreadsheets.
Comments
If you have comments, questions or suggestions about any of the Resolver One documentation, please post them to the Documentation Suggestions Forum.
