def _hpixels_to_xlsheight(self, hpixels): """Returns xls height from hpixels""" hinches = float(hpixels) / get_dpi()[1] hpoints = hinches * 72.0 xlsheight = hpoints * 20.0 return xlsheight
def _xls2row_heights(self, worksheet, tab): """Updates row_heights in code_array""" for row in xrange(worksheet.nrows): try: height_points = worksheet.rowinfo_map[row].height / 20.0 height_inches = height_points / 72.0 height_pixels = height_inches * get_dpi()[1] self.code_array.row_heights[row, tab] = height_pixels except KeyError: pass
def _row_heights2xls(self, worksheets): """Writes row_heights to xls file Format: <row>\t<tab>\t<value>\n """ xls_max_rows, xls_max_tabs = self.xls_max_rows, self.xls_max_tabs dict_grid = self.code_array.dict_grid for row, tab in dict_grid.row_heights: if row < xls_max_rows and tab < xls_max_tabs: height_pixels = dict_grid.row_heights[(row, tab)] height_inches = height_pixels / float(get_dpi()[1]) height_points = height_inches * 72.0 worksheets[tab].row(row).height_mismatch = True worksheets[tab].row(row).height = int(height_points * 20.0)