Silly, fun and useful things to do with Resolver One
  • HOME
  • About
  • Articles
  • Fun
  • Snippets
  • Disclaimer
  • Useful Links

Site by Voidspace

Email Michael

Download Resolver One

RSS Feed RSS Feed

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.

Site Built with rest2web

Creative Commons License

IronPython Wiki

IronPython in Action IronPython in Action

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 Library.Worksheet import Worksheet
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.

  • Download the Virtual Worksheets Example


Hosted by Webfaction

Return to Top

Last edited Sat Jan 26 16:28:54 2008.

Copyright ©2007 Michael Foord. All rights reserved. Design by Elemental Works. Logo by FuchsiaShock. Valid XHTML & CSS.

This work is licensed under a Creative Commons License.