Bonjour,
Je cherche à remplacer des valeurs dans un tableau html par des liens hypertext.
J'utilise donc htmlagilitypack.
J'arrive à extraire mon tableau mais je n'arrive pas à parcourir les cellules à l'intérieur. Je pense que c'est à cause de la façon dont est écrit le code Html.
En fait il faudrait que je puisse accéder à la dernière colonne du tableau.
Si quelqu'un pourrait m'orienter ! Merci !
Mon code VB :
Et voici la partie html qui m’intéresse (j'ai pas tout mis, c'est plus simple!) :
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 Dim web As New HtmlWeb() Dim html As HtmlAgilityPack.HtmlDocument = web.Load("http://www2.fr.softcarrier.com/hbdb/sclinks/htmlkat/2/fr/html/22868.html") 'On extrait le tableau For Each table As HtmlNode In html.DocumentNode.SelectNodes("//table").Where(Function(t) t.GetAttributeValue("class", "") = "im_themenkatalog_produktdaten") 'On parcoure les lignes For Each row As HtmlNode In table.SelectNodes("./tr") 'On parcoure les cellules For Each cell As HtmlNode In row.SelectNodes("./td") 'teste Dim b = cell.InnerHtml Next Next Next
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 <table width="100%" class="im_themenkatalog_produktdaten"> <tr style="background-color: #bfbfbf"> <td> <b>Produit</b> <td> <b>surface de projection en mm</b> <td style="text-align: right;"> <b>Numéro de fabricant</b> <td style="text-align: right;"> <b>Code</b> <tr style="background-color: #efefef"> <td> Mobile Boden-Leinwand MW MovieLux Compact <td> 1600 x 1600 - Format: 1:1 <td style="text-align: right;"> 13037 <td style="text-align: right;"> 70013037 <tr style="background-color: #efefef"> <td> Ecran de projection mobile sur pied MW MovieLux Compact <td> 1600 x 1200 - format: 4:3 <td style="text-align: right;"> 13036 <td style="text-align: right;"> 70013036 <tr style="background-color: #efefef"> <td> Mobile Boden-Leinwand MW MovieLux Compact <td> 1200 x 900 - Format: 4:3 <td style="text-align: right;"> 13035 <td style="text-align: right;"> 70013035 <tr style="background-color: #efefef"> <td> <td> 1800 x 1350 - Format: 4:3 <td style="text-align: right;"> 13038 <td style="text-align: right;"> 70013038 <tr style="background-color: #efefef"> <td> <td> 1940 x 1460 - Format: 4:3 <td style="text-align: right;"> 130390 <td style="text-align: right;"> 70130390 </td> </td> </td> </td> </tr> </td> </td> </td> </td> </tr> </td> </td> </td> </td> </tr> </td> </td> </td> </td> </tr> </td> </td> </td> </td> </tr> </td> </td> </td> </td> </tr> </table>
Partager