Python没有在Excel单元格中获得正确的值

我想根据它的内容给单元格的内部着色,但是当我访问它的值时,我总是得到'1.0',这个值被计算出来。

着色码:

def _colorizeTop10RejetsSheet(self): """Colore les position de la page "Top 10 Rejets" """ start_position = (5, 12) last_line = 47 for x in range(start_position[0], last_line+1): current_cell = self.workbook.Sheets("Top 10 Rejets").Cells(x, start_position[1]) current_cell.Interior.Color = self._computePositionColor(current_cell.Value) def _computePositionColor(self, position): """Colore les position de 1 a 5 en rouge de et 6 a 10 en orange""" if position < 6: return self.RED elif position < 11: return self.ORANGE else: return self.WHITE 

Excel单元格代码:

 =SI(ESTNA(RECHERCHEV(CONCATENER(TEXTE($F23;0);TEXTE($G23;"00");$H23;$I23);Données!$J:$P;7;FAUX));MAX(Données!$P:$P);RECHERCHEV(CONCATENER(TEXTE($F23;0);TEXTE($G23;"00");$H23;$I23);Données!$J:$P;7;FAUX)) 

我怎么能得到计算值?

我正在使用Python 2.7,并通过win32com与Excel进行通信

谢谢

把这个添加到_colorizeTop10Rejets方法的开头就行了

 self.xl.Calculate() 

self.xl是win32.Dispatch('Excel.Application')返回的对象