# -*- coding: iso-8859-1 -*- #. // _by_IntToCell.py #. // Transforme une cellule Row, Col en caractère. from mod import Mod def by_IntToCell( nRow, nCol ): cReturn = "" n = abs( nCol ) while n > 0: if int( Mod( n, 26 ) ) == 0: # // Pour le caractère "Z". cReturn = "Z" + cReturn n = int( n / 26 ) - 1 else: cReturn = chr( 64 + int( Mod( n, 26 ) ) ) + cReturn n = int( n / 26 ) #. endif #. enddo cReturn += str( nRow ) return cReturn ''' Dernière modification : 2022-02-11 [Exemple] import sys sys.path.append( "modules" ) from _by_IntToCell import by_IntToCell # // Transforme une cellule Row, Col en caractère. from _ex_ExcelNew import ex_ExcelNew # // Ouvre Excel. from _ex_WriteFormula import ex_WriteFormula # // Ecrit une formule dans une cellule avec options. oExcel = ex_ExcelNew() oBook = oExcel.Workbooks.Add() oSheet = oBook.Worksheets( 1 ) for l in range( 1, 10 + 1, 1 ): for c in range( 1, 30 + 1, 1 ): ex_WriteFormula( oSheet, l, c, by_IntToCell( l, c ) ) #. endfor c #. endfor l oExcel.DisplayAlerts = False oExcel = None [/Exemple] '''