Exemple #1
0
def horizontalPull(inputDecomposed, columns, labels):
    elementList = copy.copy(inputDecomposed[0])  # Pour ne pas changer sur place la decomposition initiale
    elementType = inputDecomposed[1]
    for i in range(len(elementList)):
        if elementType[i] == 'cell':
            if elementList[i][0] != '$':
                letters = ''.join([char for char in elementList[i] if char.isalpha()])
                n = columns_labels.getColumn(letters)  # On recupere le label de la colonne pour l'itérer columns fois
                newletters = columns_labels.getLabel(labels, n + columns)
                elementList[i] = newletters + elementList[i][len(letters):]  # On change la partie des lettres
    return ''.join(elementList)
 def getCellByName(self, name):  # Renvoi la celulle nommée si elle existe, 0 sinon
     name = ''.join([char for char in name if char != '$'])  # On enleve les $ eventuels
     letters = ""
     numbers = ""
     k = 0
     if not decomposition.isCell(name):
         raise decomposition.Error('Format de cellule non valide')
     else:
         while len(numbers) == 0:
             if name[k].isalpha():
                 letters += name[k]
             else:
                 numbers += name[k]
             k += 1
         while k < len(name):
             numbers += name[k]
             k += 1
     try:
         return self.getCell(int(numbers) - 1, columns_labels.getColumn(letters) - 1)
     except Exception:
         raise decomposition.Error('Cellule {} non trouvée'.format(name))