Feuille vide
" n_cols = max(len(row) for row in grid) out = [ ( '| ' ) ] out += [f" | {get_column_letter(c)} | " for c in range(1, n_cols + 1)] out.append("
|---|---|
| {r} | ') for c, val in enumerate(row, start=1): ref = f"{get_column_letter(c)}{r}" # The cached result only makes sense for a formula cell: on a plain # value cell the two reads are identical and showing both would # duplicate the text. shadow = "" if cached is not None and val.startswith("="): # `c` is 1-based (A1 notation) and `r` too, while the grid is # 0-based: translate both. cval = _cell_cached(cached, r - 1, c - 1) if cval and cval != val: # The tooltip is translated client-side from # `xlsx.cached_value_title`; never hardcode UI text here. shadow = ( f'' f"{html.escape(cval)}" ) out.append( f'{html.escape(val)}{shadow} | ' ) out.append("