Bonjour Laurent,
Laurent Godard a écrit :
Bonjour Christian
Pour compléter la réponse d'hier, un test avec macro ne donne rien.
si la cellule contient '100 avec apostrophe
contenu= oCell.String
contenu = oCell.Type par contre
retourne
http://api.openoffice.org/docs/common/ref/com/sun/star/table/CellContentType.html
voir
http://api.openoffice.org/docs/common/ref/com/sun/star/table/XCell.html#getType
je pense que ce peut etre la voie
La cellule A2 contient '100
Sub Main
laFeuille = thisComponent.CurrentController.ActiveSheet
A2 = laFeuille.getCellRangeByname("A2")
print A2.type
valeur = A2.string
A2.string = ""
A2.value = valeur
'peut etre utiliser les focntions de conversion si necessaire
print A2.type
End Sub
Le type de la cellule passe bien à 1, c'est a dire numérique
Cordialement
Laurent
Pour un traitement de ce problème j'avais écris cela :
'=== Debut de procedure
Sub Main
Dim oDoc As Object, oCurSel As Object, oActiveSheet As Object, oCell As
Object
Dim sNameSheet As String
Dim nameCol()
'Dim nameLig()
Dim iCol As Integer, iRow As Integer
Dim iStartRow As Integer, iEndRow As Integer
Dim iStartCol As Integer, iEndCol As Integer
Dim iNbreCells As Integer
Dim startTime, endTime, duration
Dim sMsg As String
oDoc = ThisComponent
With oDoc
oActiveSheet = .getCurrentController().getActiveSheet()
oCurSel = .getCurrentSelection()
End With
sNameSheet = oActiveSheet.getName()
With oCurSel
nameCol()= .getColumnDescriptions()
'nameLig()= .getRowDescriptions()
'recuperation adresse zone selectionnee
iStartRow = .getRangeAddress().StartRow
iEndRow = .getRangeAddress().EndRow
iStartCol = .getRangeAddress().StartColumn
iEndCol = .getRangeAddress().EndColumn
End With
iNbreCells = ( iEndCol-iStartCol+1 ) * ( iEndRow-iStartRow+1 )
If iNbreCells > 9999 Then
sMsg = "Le nombre de cellules à traiter étant trés important" &
_
Chr(10) & "le temps de traitement risque d'être trés long
!"
MsgBox( sMsg, 48, "Alerte - Temps de traitement")
End If
sMsg = sNameSheet
sMsg = sMsg & Chr(10) & "de la " & nameCol(lbound(nameCol())) & " à la
" & nameCol(ubound(nameCol()))
sMsg = sMsg & Chr(10) & "de la ligne " & iStartRow+1 & " à la ligne " &
iEndRow+1
sMsg = sMsg & Chr(10) & "soit " & iNbreCells & " cellules."
If MsgBox( sMsg, 4+32+256, "Cellules à traiter" ) = 6 Then
startTime = Time()
For iCol = iStartCol To iEndCol
For iRow = iStartRow To iEndRow
oCell = oActiveSheet.getCellByPosition( iCol, iRow )
If Left( oCell.formula, 1 )= "'" Then
oCell.formula = Mid( oCell.formula, 2,
Len( oCell.formula ) )
End If
Next iRow
Next iCol
endTime = Time()
duration = TimeValue( endTime )-TimeValue( startTime )
sMsg = "Conversion terminée" & Chr(10) & "temps de traitement = " &
CDate( duration )
MsgBox ( sMsg )
End If
End Sub
'=== Fin de procedure
Si ca peut aider.
Cordialement
--
Francois Gatto
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]