Resolver Hacks contains information and code for doing fun and useful things with Resolver One. This site is created and maintained by Michael Foord, not by Resolver Systems. Please read the disclaimer before using any of the code on this site.
Virtual Worksheets
A common step in working with spreadsheet data is creating intermediate tables. In a program we might use an array (which of course you still can in Resolver One), but in a spreadsheet the basic way of storing data is with cell ranges and worksheets. A cell range is just a view onto an area of a worksheet, and the disadvantage of worksheets are that they are always visible. The advatage of using spreadsheet objects rather than arrays, is that you get all the methods and properties normally available on spreadsheet objects.
One way round this problem is to directly create a worksheet without adding it to the workbook. This is a normal worksheet, but is not displayed in the grid.
from random import randint
virtual = Worksheet('Virtual')
virtual_range = CellRange(virtual.Cells.A1, virtual.Cells.A1.Offset(9, 9))
for col in range(1, 11):
for row in range(1, 11):
virtual_range[col, row] = randint(1, 10)
CopyRange(virtual_range, workbook['Sheet1'].Cells.A1)
This example creates a worksheet, with a cell range (virtual_range) covering a ten by ten block on the worksheet. This is populated with data, and then copied back into a visible worksheet using the CopyRange function.
Last edited Sat Jan 26 16:28:54 2008.

IronPython in Action