IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

VB.NET Discussion :

Collage vers Word d'un texte identé avec gestion gras/italique..


Sujet :

VB.NET

  1. #1
    Membre averti
    Inscrit en
    Juin 2011
    Messages
    258
    Détails du profil
    Informations forums :
    Inscription : Juin 2011
    Messages : 258
    Points : 334
    Points
    334
    Par défaut Collage vers Word d'un texte identé avec gestion gras/italique..
    Bonjour à tous,

    Je bloque sur ce souci depuis hier matin et je commence à plus avoir les idées claires du tout, donc si quelqu'un pouvait m'éclairer ce serait sympa.

    Donc j'expose le bouzin:

    J'ai un formulaire assez complexe (composé d'onglets, d'onglets dans des onglets, de groupbox, panels et toute la compagnie). A partir de ce formulaire et des saisies utilisateur, j'ai créé une chaine de type String se composant comme ça:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
     
    Partie
        Sous-Partie
            Nom du champ: valeur
    ...

    Dont voici le code (il fonctionne, aucun souci majeur dessus)

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
     
    Private Sub recapTechnique(ByVal from As Control)
    	Dim cpt As Integer = 0
    	If TypeOf from Is Form Then
    		str = Nothing
    		str += "<strong>" & from.Text & vbNewLine & "</strong>"
    	Else
    		If Not TypeOf from Is TabControl Then
    			Dim parent As Control = from.Parent
    			While Not TypeOf parent Is Form
    				parent = parent.Parent
    				str += vbTab
    				cpt += 1
    			End While
    			Select Case from.GetType.Name
    				Case "TabPage"
    					str += "<strong>" & from.Text & vbNewLine & "</strong>"
    				Case "GroupBox"
    					str += "<i>" & from.Text & vbNewLine & "</i>"
    				Case Else
    					str += from.Text & vbNewLine
    			End Select
    		End If
    	End If
     
    	For Each cont In from.Controls
    		If TypeOf cont Is GroupBox Or TypeOf cont Is TabPage Or TypeOf cont Is Panel Or TypeOf cont Is TabControl Then
    			recapTechnique(cont)
    		Else
    			If Not TypeOf cont Is Label And Not TypeOf cont Is Button Then
    				If TypeOf cont Is ComboBox Then
    					If Not cont.Text = "" Then
    						For i = 0 To cpt
    							str += vbTab
    						Next
    						If Not IsNothing(cont.Parent.Controls("lab" & cont.Name)) Then
    							str += "<souligne>" & cont.Parent.Controls("lab" & cont.Name).Text & "</souligne>" & " :" & cont.Text & vbNewLine
    						Else
    							If TypeOf cont.Parent Is Label Then
    								str += "<souligne>" & cont.Parent.Controls("lab" & cont.Parent.Name).Text & "</souligne>" & " :" & cont.Text & vbNewLine
    							Else
    								str += cont.Text & vbNewLine
    							End If
    						End If
    					End If
    				Else
    					If TypeOf cont Is RadioButton Or TypeOf cont Is CheckBox Then
    						If cont.checked Then
    							For i = 0 To cpt
    								str += vbTab
    							Next
    							If Not IsNothing(cont.Parent.Controls("lab" & cont.Name)) Then
    								str += "<souligne>" & cont.Parent.Controls("lab" & cont.Name).Text & "</souligne>" & " :" & cont.Text & vbNewLine
    							Else
    								If TypeOf cont.Parent Is Label Then
    									str += "<souligne>" & cont.Parent.Controls("lab" & cont.Parent.Name).Text & "</souligne>" & " :" & cont.Text & vbNewLine
    								Else
    									str += cont.Text & vbNewLine
    								End If
    							End If
    						End If
    					Else
    						If TypeOf cont Is TextBox Then
    							If Not cont.Text = "" Then
    								Dim formatageTxt As String
    								Dim passageLigne As String = Nothing
     
    								For i = 0 To cpt
    									passageLigne += vbTab
    									str += vbTab
    								Next
    								cont.Text = cont.Text.ToString.Replace(Chr(10), Chr(10) & passageLigne)
     
    								If Not IsNothing(cont.Parent.Controls("lab" & cont.Name)) Then
    									str += "<souligne>" & cont.Parent.Controls("lab" & cont.Name).Text & "</souligne>" & " :" & cont.Text & vbNewLine
    								Else
    									If TypeOf cont.Parent Is Label Then
    										str += "<souligne>" & cont.Parent.Controls("lab" & cont.Parent.Name).Text & "</souligne>" & " :" & cont.Text & vbNewLine
    									Else
    										str += cont.Text & vbNewLine
    									End If
    								End If
    							End If
    						End If
    					End If
    				End If
    			End If
    		End If
    	Next
    End Sub
    A partir de cette chaine, qui, vous l'aurez remarqué, est composée de balises, je voudrais générer un document word. Celles-ci devraient permettre de mettre en gras, italique ou souligner certains passages (comme si on utilisait word donc).

    J'ai donc écrit une autre méthode permettant de recopier en formattant le texte. J'ai fait au plus simple d'abord (gestion d'une seule balise). Aucune souci particulier

    Voici le code

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
     
    Private Sub gestionWord(ByVal text As String)
    	doc = New Word.Document
     
    	Dim cptLettres As Integer = 0
     
    	doc = objWord.Documents.Add()
     
    	For i = 0 To text.Length - 1
                'où se trouve la balise de commencement
                Dim commencementStrong = text.IndexOf("<strong>", i)
                Dim finStrong, longueurEntreBalise, indexCommencement As Integer
                'si il y a bien un commencement et une fin
                If commencementStrong >= 0 Then
    				'où se trouve la balise de fermeture
                    finStrong = text.IndexOf("</strong>", commencementStrong)
                    'index début balise + longueur de la balise
                    indexCommencement = commencementStrong + "<strong>".Length
                    'index début de la balise de fin + fin de la balise de début
                    longueurEntreBalise = finStrong - indexCommencement
     
                    doc.ActiveWindow.Selection.TypeText(text.Substring(i, commencementStrong - i))
     
                    doc.ActiveWindow.Selection.Font.Bold = True
     
                    'on prend cette partie du texte, le colle
                    doc.ActiveWindow.Selection.TypeText(text.Substring(indexCommencement, longueurEntreBalise))
                    cptLettres += longueurEntreBalise
                    'reset des types de police
                    doc.ActiveWindow.Selection.Font.Bold = False
                Else
                    ''si il reste quand même des balises dans le texte
                    Dim autreBalise = text.IndexOf("<", i)
                    If autreBalise <> -1 Then
                        'on prend la partie avant la balise et on la colle sans type de police
                        doc.ActiveWindow.Selection.TypeText(text.ToString.Substring(i, autreBalise - i))
                        i = autreBalise
                    Else
                        doc.ActiveWindow.Selection.TypeText(text.Substring(i, text.Length - i))
                        Exit For
                    End If
                    'sinon, c'est que les balises sont finies, donc on colle le reste du texte
     
                    'End If
                    'debugl += "Suite balise: " & autreBalise
                End If
                If finStrong > i Then
                    i = finStrong + "<strong>".Length + 1
                End If
            Next
    End Sub
    Donc le rendu actuel est ok pour la mise en gras. L'indentation reste et le texte que je veux en gras l'est bien.
    Problème: Adapter la fonction pour gérer plusieurs balises. Étant donné, qu'à ma connaissance, on ne peut pas baliser le texte de sorte que word reconnaisse les passages dont le texte a un traitement particulier, il faut coller des morceaux de textes un à un.

    Le souci intervient avec les imbrications de balises surtout.

    Un texte composé de <strong> machin truc <i> bidule </i> </strong> est plus compliqué à gérer étant donné qu'il faudra d'abord coller le "machin truc" en gras, puis le "bidule" en gras + italique.

    Bref, j'ai testé pas mal de choses qui n'ont pas donné du tout le résultat recherché.

    Je pense qu'il faut parcourir le texte, repérer la première balise, prendre le texte intérieur, y mettre un booléen, parcourir le texte à l'intérieur, testé si il y a une balise etc etc.

    Vu la logique, j'ai pensé à du récursif, mais je n'ai pas encore réussi à le faire.

    Je pourrais aussi stocker tous les indices des textes balisés, lettre à lettre mais bon ça ferait une fonction à 53454534^10 tests...

    Merci de passer par ici!

  2. #2
    Membre averti
    Inscrit en
    Juin 2011
    Messages
    258
    Détails du profil
    Informations forums :
    Inscription : Juin 2011
    Messages : 258
    Points : 334
    Points
    334
    Par défaut
    J'ai écrit une fonction récursive. Le résultat n'est pas encore celui recherché mais s'en est "proche" (ça fait pas totalement n'importe quoi :p)

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
     
    Private Sub recopiage(ByVal text, ByVal depart, ByVal arrivee, Optional ByVal boolStrong = False, Optional ByVal boolI = False, Optional ByVal boolSouligne = False)
    	Dim balises As String() = {"<strong>", "<souligne>", "<i>"}
    	Dim sousTexte As String = text.SubString(depart, arrivee - depart)
    	'tableaux:
    	'0: debut du texte de la balise
    	'1: fin du texte de la balise
    	'2: booléen strong
    	'3: booléen italique
    	'4: booléen underline
    	'5: nom balise
    	Dim tabStrong(6), tabI(6), tabSouligne(6)
    	Dim siStrong, siI, siSouligne As Boolean
    	For i = depart To arrivee
    		Dim bool As Boolean = False
    		Dim premiereBalise As Integer = arrivee
     
    		'on regarde ce que contient la chaine
    		For Each balise In balises
    			If sousTexte.Contains(balise) Then
    				'on recherche la toute première balise afin de coller la première partie du texte
    				If sousTexte.IndexOf(balise, i) < premiereBalise Or premiereBalise = -1 Then
    					premiereBalise = sousTexte.IndexOf(balise, i)
    				End If
    				'repérer la fin de balise
    				Select Case balise
    					Case "<strong>"
    						tabStrong(0) = sousTexte.IndexOf(balise, i) + balise.Length
    						tabStrong(1) = sousTexte.IndexOf(balise.Replace("<", "</"), i)
    						tabStrong(2) = True
    						tabStrong(3) = boolI
    						tabStrong(4) = boolSouligne
    						tabStrong(5) = balise
    						siStrong = True
    					Case "<i>"
    						tabI(0) = sousTexte.IndexOf(balise, i) + balise.Length
    						tabI(1) = sousTexte.IndexOf(balise.Replace("<", "</"), i)
    						tabI(2) = boolStrong
    						tabI(3) = True
    						tabI(4) = boolSouligne
    						tabI(5) = balise
    						siI = True
    					Case "<souligne>"
    						tabSouligne(0) = sousTexte.IndexOf(balise, i) + balise.Length
    						tabSouligne(1) = sousTexte.IndexOf(balise.Replace("<", "</"), i)
    						tabSouligne(2) = boolStrong
    						tabSouligne(3) = boolI
    						tabSouligne(4) = True
    						tabSouligne(5) = balise
    						siSouligne = True
    				End Select
    				bool = True
    			End If
    		Next
    		'on insère ce qu'il y a avant la balise
    		doc.ActiveWindow.Selection.Font.Bold = boolStrong
    		doc.ActiveWindow.Selection.Font.Italic = boolI
    		doc.ActiveWindow.Selection.Font.Underline = boolSouligne
    		doc.ActiveWindow.Selection.TypeText(text.Substring(i, premiereBalise - i))
    		doc.ActiveWindow.Selection.Font.Bold = False
    		doc.ActiveWindow.Selection.Font.Italic = False
    		doc.ActiveWindow.Selection.Font.Underline = False
    		'on vérifie qu'une balise est bien présente
    		If bool Then
    			'récupération puis utilisation de la première balise
    			Dim commencements As New List(Of Integer)
    			If siStrong Then
    				commencements.Add(tabStrong(0))
    			End If
    			If siI Then
    				commencements.Add(tabI(0))
    			End If
    			If siSouligne Then
    				commencements.Add(tabSouligne(0))
    			End If
    			Dim tabPremiereBalise() = minimum(commencements, tabStrong, tabI, tabSouligne)
     
    			recopiage(text, tabPremiereBalise(0), tabPremiereBalise(1), tabPremiereBalise(2), tabPremiereBalise(3), tabPremiereBalise(4))
    			i = tabPremiereBalise(1) + tabPremiereBalise(5).Length
    		Else
    			i = arrivee
    		End If
    	Next
    End Sub
     
    Private Function minimum(ByVal tab, ByRef tabStrong, ByRef tabI, ByRef tabSouligne) As Object()
    	Dim mini As Integer = tab(0)
    	Dim indexMini As Integer = 0
    	Dim cptIndex As Integer
    	For Each item In tab
    		cptIndex = 0
    		For Each items In tab
    			If items < item Then
    				mini = items
    				indexMini = cptIndex
    			End If
    			cptIndex += 1
    		Next
    	Next
    	Select Case indexMini
    		Case 0
    			Return tabStrong
    		Case 1
    			Return tabI
    		Case 2
    			Return tabSouligne
    	End Select
    End Function
    Ça donne:


    (j'ai effacé les informations)
    Images attachées Images attachées  

  3. #3
    Membre averti
    Inscrit en
    Juin 2011
    Messages
    258
    Détails du profil
    Informations forums :
    Inscription : Juin 2011
    Messages : 258
    Points : 334
    Points
    334
    Par défaut
    Quelques changements, ça améliore le rendu. Mais problème, ça part en boucle infinie au bout d'un moment, pas encore trouvé pourquoi. :/

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
     
    Private Sub gestionWord(ByVal text As String)
    	Dim balises As String() = {"<strong>", "<souligne>", "<i>"}
    	doc = New Word.Document
     
    	Dim cptLettres As Integer = 0
     
    	doc = objWord.Documents.Add()
     
    	With objWord
    		.Visible = True
    		.ActiveWindow.Selection.Font.Name = "Arial"
    		.ActiveWindow.Selection.Font.Size = 8
    		With .ActiveWindow.Selection.ParagraphFormat
    			.SpaceBeforeAuto = False
    			.SpaceAfterAuto = False
    			.FirstLineIndent = -3.13
    		End With
    		.ActiveWindow.ActivePane.VerticalPercentScrolled = 0
    		With .ActiveWindow.Selection.ParagraphFormat
    			.LeftIndent = 0.75
    			.SpaceBeforeAuto = False
    			.SpaceAfterAuto = False
    		End With
    		.ActiveWindow.ActivePane.VerticalPercentScrolled = 0
    	End With
    	recopiage(text, 0, text.Length - 1, False, False, False)
    End Sub
     
    Private Sub recopiage(ByVal text, ByVal depart, ByVal arrivee, Optional ByVal boolStrong = False, Optional ByVal boolI = False, Optional ByVal boolSouligne = False)
    	Dim balises As String() = {"<strong>", "<souligne>", "<i>"}
    	'Dim sousTexte As String = text.SubString(depart, arrivee - depart)
    	'tableaux:
    	'0: debut du texte de la balise
    	'1: fin du texte de la balise
    	'2: booléen strong
    	'3: booléen italique
    	'4: booléen underline
    	'5: nom balise
    	Dim tabStrong(6), tabI(6), tabSouligne(6)
    	Dim siStrong, siI, siSouligne As Boolean
    	For i = depart To arrivee
    		Dim sousTexte = text.SubString(i, arrivee - i)
    		Dim bool As Boolean = False
    		Dim premiereBalise As Integer = arrivee
    		'''''''''''''''''''''''''''''''''''''''''
    		'à tester i => i - arrivee
    		'''''''''''''''''''''''''''''''''''''''''
    		'on regarde ce que contient la chaine
    		For Each balise In balises
    			If sousTexte.Contains(balise) Then
    				'on recherche la toute première balise afin de coller la première partie du texte
    				If text.IndexOf(balise, i) < premiereBalise Or premiereBalise = -1 Then
    					premiereBalise = text.IndexOf(balise, i)
    				End If
    				'repérer la fin de balise
    				Select Case balise
    					Case "<strong>"
    						tabStrong(0) = text.IndexOf(balise, i) + balise.Length
    						tabStrong(1) = text.IndexOf(balise.Replace("<", "</"), i)
    						tabStrong(2) = True
    						tabStrong(3) = boolI
    						tabStrong(4) = boolSouligne
    						tabStrong(5) = balise
    						siStrong = True
    					Case "<i>"
    						tabI(0) = text.IndexOf(balise, i) + balise.Length
    						tabI(1) = text.IndexOf(balise.Replace("<", "</"), i)
    						tabI(2) = boolStrong
    						tabI(3) = True
    						tabI(4) = boolSouligne
    						tabI(5) = balise
    						siI = True
    					Case "<souligne>"
    						tabSouligne(0) = text.IndexOf(balise, i) + balise.Length
    						tabSouligne(1) = text.IndexOf(balise.Replace("<", "</"), i)
    						If tabSouligne(1) = -1 Then
    							Debug.Print(balise.Replace("<", "</"))
    							Debug.Print(text.ToString.Substring(1649, 100))
    						End If
    						tabSouligne(2) = boolStrong
    						tabSouligne(3) = boolI
    						tabSouligne(4) = True
    						tabSouligne(5) = balise
    						siSouligne = True
    				End Select
    				Debug.Print("=============================================================================")
    				Debug.Print(text.ToString.Substring(text.IndexOf(balise, i) + balise.Length, text.IndexOf(balise.Replace("<", "</"), i) - text.IndexOf(balise, i) + balise.Length))
    				bool = True
    			End If
    		Next
    		'on insère ce qu'il y a avant la balise
    		doc.ActiveWindow.Selection.Font.Bold = boolStrong
    		doc.ActiveWindow.Selection.Font.Italic = boolI
    		doc.ActiveWindow.Selection.Font.Underline = boolSouligne
    		doc.ActiveWindow.Selection.TypeText(text.Substring(i, premiereBalise - i))
    		doc.ActiveWindow.Selection.Font.Bold = False
    		doc.ActiveWindow.Selection.Font.Italic = False
    		doc.ActiveWindow.Selection.Font.Underline = False
    		'on vérifie qu'une balise est bien présente
    		If bool Then
    			'récupération puis utilisation de la première balise
    			Dim commencements As New List(Of Integer)
    			If siStrong Then
    				commencements.Add(tabStrong(0))
    			End If
    			If siI Then
    				commencements.Add(tabI(0))
    			End If
    			If siSouligne Then
    				commencements.Add(tabSouligne(0))
    			End If
    			commencements.Sort()
    			Dim tabPremiereBalise() = minimum(commencements, tabStrong, tabI, tabSouligne)
    			i = tabPremiereBalise(1) + tabPremiereBalise(5).Length
    			recopiage(text, tabPremiereBalise(0), tabPremiereBalise(1), tabPremiereBalise(2), tabPremiereBalise(3), tabPremiereBalise(4))
    		Else
    			i = arrivee
    		End If
    	Next
    End Sub
     
    Private Function minimum(ByVal tab, ByRef tabStrong, ByRef tabI, ByRef tabSouligne) As Object()
    	If tabStrong(0) = tab(0) Then
    		Return tabStrong
    	End If
    	If tabI(0) = tab(0) Then
    		Return tabI
    	End If
    	If tabSouligne(0) = tab(0) Then
    		Return tabSouligne
    	End If
    End Function
    Le rendu (début)

    Puis le souci:
    Images attachées Images attachées   

  4. #4
    Membre averti
    Inscrit en
    Juin 2011
    Messages
    258
    Détails du profil
    Informations forums :
    Inscription : Juin 2011
    Messages : 258
    Points : 334
    Points
    334
    Par défaut
    Edit: Je viens de voir pourquoi il se produit.

    En fait, il prend deux fois d'affilé la même balise, je ne sais pas pourquoi, et du coup i prend l'index de fin de la balise, en s'incrémentant il le dépasse donc.


    Message original:
    J'ai trouvé le souci, mais toujours pas pourquoi il se produit.

    En fait, parfois, la fin de la balise est plus petite que i et ça part en boucle infinie.

    J'ai donc modifié le code:

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
     
    If i < tabPremiereBalise(1) + tabPremiereBalise(5).Length Then
    	i = tabPremiereBalise(1) + tabPremiereBalise(5).Length
    	recopiage(text, tabPremiereBalise(0), tabPremiereBalise(1), tabPremiereBalise(2), tabPremiereBalise(3), tabPremiereBalise(4))
    Else 
    	Dim fin As New List(Of Integer())
    	If Not IsNothing(tabStrong(0)) Then
    		fin.Add(New Integer() {tabStrong(1), tabStrong(5).length})
    	End If
    	If Not IsNothing(tabI(0)) Then
    		fin.Add(New Integer() {tabI(1), tabI(5).length})
    	End If
    	If Not IsNothing(tabSouligne(0)) Then
    		fin.Add(New Integer() {tabSouligne(1), tabSouligne(5).length})
    	End If
    	Dim indiceMax As Integer
    	For Each nombre In fin(0)
    		Dim cpt = 0
    		For Each comparer In fin(0)
    			If comparer > nombre Then
    				indiceMax = cpt
    			End If
    			cpt += 1
    		Next
    	Next
    	Dim max As Integer = fin(indiceMax)(0) + fin(indiceMax)(1) + 1
    	recopiage(text, max, text.ToString.Length - 1, , , )
    	i = arrivee
    End If
    (Condition ajoutée et contenu else aussi)

    Donc en fait, avec ce code, si i est plus grand que la fin de la balise (le commencement de la balise de fin + taille de la balise) alors on "saute" cette partie et on continue sur la prochaine.

    Donc la boucle n'est plus, mais c'est pas pour ça que c'est parfait. :p

    Je ne comprends pas comment i peut avoir une valeur supérieure au commencement de ce qui est entre balises, étant donné qu'on trouve cette balise dans i. (text.IndexOf(balise, i))

    Si quelqu'un voit pourquoi au bout d'un moment ça donne ça je suis preneur. Merci

  5. #5
    Membre averti
    Inscrit en
    Juin 2011
    Messages
    258
    Détails du profil
    Informations forums :
    Inscription : Juin 2011
    Messages : 258
    Points : 334
    Points
    334
    Par défaut
    Bon ben j'ai réglé mon problème, je ne sais pas comment mais ça fonctionne.

    J'ai changé la balise sur les groupBox par une <strong> et ça fonctionne sans souci, je ne sais pas pourquoi...

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Réponses: 6
    Dernier message: 08/01/2013, 22h35
  2. Données Excel vers Word avec critères précis
    Par Z20500 dans le forum Excel
    Réponses: 4
    Dernier message: 18/09/2007, 18h38
  3. Réponses: 2
    Dernier message: 12/02/2007, 13h39
  4. Réponses: 3
    Dernier message: 12/09/2006, 05h54
  5. Envoi d'info d'Access vers Word avec des signets
    Par Laetis dans le forum Access
    Réponses: 1
    Dernier message: 03/05/2006, 19h04

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo