def table_info(self,shapes): tr = TableRecognition(shapes) tr.run() msg = u"" msg += "dimension: rows=%d, cols=%d\r\n" % tr.dimension msg += "median spacing: %r\r\n" % tr.median_spacing() helpers.log(msg)
def align_table_set_spacing(self, shapes, value): try: v = float(value) except ValueError: traceback.print_exc() return tr = TableRecognition(shapes) tr.run() tr.align(v)
def fit_table_to_content(self, shapes, presentation): with self.presentation_tag(presentation) as tag: if tag.is_area_set: left = tag.contentarea_left top = tag.contentarea_top width = tag.contentarea_width height = tag.contentarea_height else: left = 0 top = 0 setup = presentation.PageSetup width = setup.SlideWidth height = setup.SlideHeight tr = TableRecognition(shapes) tr.run() spacing = tr.median_spacing() tr.fit_content(left, top, width, height, spacing)
def fit_cells(self,shapes): tr = TableRecognition(shapes) tr.run() tr.align(spacing=tr.median_spacing(), fit_cells=True)
def transpose_table(self,shapes): tr = TableRecognition(shapes) tr.run() spacing = tr.median_spacing() left, top, width, height = tr.get_bounds() tr.transpose() tr.transpose_cell_size(); tr.fit_content(left, top, width, height, spacing)
def decrease_spacing(self,shapes): tr = TableRecognition(shapes) tr.run() tr.change_spacing_in_bounds(-1)
def fit_cells_inplace(self,shapes): tr = TableRecognition(shapes) tr.run() spacing = tr.median_spacing() bounds = tr.get_bounds() tr.fit_content(*bounds, spacing=spacing, fit_cells=True)
def align_table_median_increase(self, shapes): tr = TableRecognition(shapes) tr.run() tr.align(tr.median_spacing()+1)
def align_table_zero(self,shapes): tr = TableRecognition(shapes) tr.run() tr.align(0)
def align_table_set_spacing_get_text(self, shapes): tr = TableRecognition(shapes) tr.run() res = tr.median_spacing() print res return str(res)