![]() |
Marina
API for the module-docking wx framework
|
Public Member Functions | |
def | __init__ |
def | getExcelApp |
def | addSheetAfter |
def | deleteSheet |
def | getSheet |
def | activateSheet |
def | add2cell |
def | addRow |
def | addMultipleRows |
def | getRangeByCells |
def | fitCols |
def | fitCol |
def | setColWidth |
def | formatRange |
def | resetColorPallet |
def | mergeRange |
def | save |
def | close |
Public Attributes | |
excelapp | |
workbook | |
file_name | |
default_sheet |
Excel class for creating spreadsheets - esp writing data and formatting them Based in part on #http://snippets.dzone.com/posts/show/2036, and http://www.markcarter.me.uk/computing/python/excel.html
def recipe-528870-1::ExcelWriter::__init__ | ( | self, | |
file_name, | |||
default_sheet_name, | |||
make_visible = False |
|||
) |
Open spreadsheet
def recipe-528870-1::ExcelWriter::activateSheet | ( | self, | |
sheet_name | |||
) |
Activate named sheet.
def recipe-528870-1::ExcelWriter::add2cell | ( | self, | |
row, | |||
col, | |||
content, | |||
sheet = None |
|||
) |
Add content to cell at row,col location. NB only recommended for small amounts of data http://support.microsoft.com/kb/247412.
def recipe-528870-1::ExcelWriter::addMultipleRows | ( | self, | |
start_row, | |||
list_data_tuples, | |||
start_col = 1 , |
|||
sheet = None |
|||
) |
Adds data multiple rows at a time, not cell by cell. Takes list of tuples e.g. cursor.fetchall() after running a query One tuple per row. Much more efficient than cell by cell or row by row. http://support.microsoft.com/kb/247412. Returns next available row.
def recipe-528870-1::ExcelWriter::addRow | ( | self, | |
row_i, | |||
data_tuple, | |||
start_col = 1 , |
|||
sheet = None |
|||
) |
Add row in a single operation. Takes a tuple per row. Much more efficient than cell by cell. http://support.microsoft.com/kb/247412.
def recipe-528870-1::ExcelWriter::addSheetAfter | ( | self, | |
sheet_name, | |||
index_or_name | |||
) |
Add new sheet to workbook after index_or_name (indexing starts at 1).
def recipe-528870-1::ExcelWriter::close | ( | self | ) |
Close spreadsheet resources
def recipe-528870-1::ExcelWriter::deleteSheet | ( | self, | |
sheet_name | |||
) |
Delete named sheet
def recipe-528870-1::ExcelWriter::fitCol | ( | self, | |
col_n, | |||
sheet = None |
|||
) |
Fit column to contents.
def recipe-528870-1::ExcelWriter::fitCols | ( | self, | |
col_start, | |||
col_end, | |||
sheet = None |
|||
) |
Fit colums to contents.
def recipe-528870-1::ExcelWriter::formatRange | ( | self, | |
range, | |||
style | |||
) |
Add formatting to a cell/group of cells. To get methods etc record a macro in EXCEL and look at it. To get the value of Excel Constants such as xlEdgeLeft (7) or xlThin (2) type e.g. Debug.Print xlEdgeLeft in the Immediate window of the VBA editor and press enter. http://www.ureader.com/message/33389340.aspx For changing the pallete of 56 colours ref: http://www.cpearson.com/excel/colors.htm
def recipe-528870-1::ExcelWriter::getExcelApp | ( | self | ) |
Get Excel App for use
def recipe-528870-1::ExcelWriter::getRangeByCells | ( | self, | |
cell_start_row, | |||
cell_start_col, | |||
cell_end_row, | |||
cell_end_col, | |||
sheet = None |
|||
) |
Get a range defined by cell start and cell end e.g. (1,1) A1 and (7,2) B7
def recipe-528870-1::ExcelWriter::getSheet | ( | self, | |
sheet_name | |||
) |
Get sheet by name.
def recipe-528870-1::ExcelWriter::mergeRange | ( | self, | |
range | |||
) |
Merge range
def recipe-528870-1::ExcelWriter::resetColorPallet | ( | self, | |
color_index, | |||
color | |||
) |
Reset indexed color in pallet (limited to 1-56). Get color values by Debug.Print RGB(230,230,230) in Excel Immediate window
def recipe-528870-1::ExcelWriter::save | ( | self | ) |
Save spreadsheet as filename - wipes if existing
def recipe-528870-1::ExcelWriter::setColWidth | ( | self, | |
col_n, | |||
width, | |||
sheet = None |
|||
) |
Set column width.