ASP Excel Probleme de conversion de cellule
Bonjour,
Je ne sais pas si je dois poster ce topic dans ASP ou Excel mais comme je dois développer un truc qui marche, je le met ici.
J'ai un script tout simple qui récupère des données d'une BD via asp et qui les écrit dans un fichier Excel.
Le problème est que quand j'ouvre ce fichier, j'ai des erreurs excel comme quoi :
"Impossible de lire l'enregistrement n° XXX" ( g ce message plusieurs fois)
puis :
"Microsoft Office Excel ne peut pas convertir certaines cellules"
J'ai l'impression que ces erreurs sont due a des champs de ma BD qui sont plutôt long et tronqués dans mon fichier excel. Y a til une solution a ce problème ? Laquelle :mouarf: ?
Je donne mon code au cas où :
Code:
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
|
<%
Set fso = CreateObject("Scripting.filesystemobject")
Set Fic = fso.CreateTextFile(server.mappath(monFichier), True)
%><a href="<%=monFichier%>">Telecharger le fichier Excel</a><%
Fic.writeLine "ID;PWXL;N;E" ' Début du codage excel
Fic.writeLine "C;Y1;X1;K" & CHR(34) & ("N° du changement") & CHR(34)
Fic.writeLine "C;Y1;X2;K" & CHR(34) & ("Date de création") & CHR(34)
Fic.writeLine "C;Y1;X3;K" & CHR(34) & ("Code") & CHR(34)
Fic.writeLine "C;Y1;X4;K" & CHR(34) & ("Date de planification") & CHR(34)
Fic.writeLine "C;Y1;X5;K" & CHR(34) & ("Nom") & CHR(34)
Fic.writeLine "C;Y1;X6;K" & CHR(34) & ("Prenom") & CHR(34)
Fic.writeLine "C;Y1;X7;K" & CHR(34) & ("Login") & CHR(34)
Fic.writeLine "C;Y1;X8;K" & CHR(34) & ("Value") & CHR(34)
Fic.writeLine "C;Y1;X9;K" & CHR(34) & ("Commentaire") & CHR(34)
Fic.writeLine "C;Y1;X10;K" & CHR(34) & ("Date de modification") & CHR(34)
Ligne = 2
for i=1 to nbRow
Fic.writeLine "C;Y" & Ligne & ";X1;K" & CHR(34) & (oRS.fields(0)) & CHR(34)
Fic.writeLine "C;Y" & Ligne & ";X2;K" & CHR(34) &(oRS.fields(1)) & CHR(34)
Fic.writeLine "C;Y" & Ligne & ";X3;K" & CHR(34) &(oRS.fields(2)) & CHR(34)
Fic.writeLine "C;Y" & Ligne & ";X4;K" & CHR(34) &(oRS.fields(3)) & CHR(34)
Fic.writeLine "C;Y" & Ligne & ";X5;K" & CHR(34) & (oRS.fields(4)) & CHR(34)
Fic.writeLine "C;Y" & Ligne & ";X6;K" & CHR(34) &(oRS.fields(5)) & CHR(34)
Fic.writeLine "C;Y" & Ligne & ";X7;K" & CHR(34) &(oRS.fields(6)) & CHR(34)
Fic.writeLine "C;Y" & Ligne & ";X8;K" & CHR(34) &(oRS.fields(7)) & CHR(34)
Fic.writeLine "C;Y" & Ligne & ";X9;K" & CHR(34) &(oRS.fields(8)) & CHR(34)
Fic.writeLine "C;Y" & Ligne & ";X10;K" & CHR(34) &(oRS.fields(9)) & CHR(34)
Ligne = Ligne + 1
RS.MoveNext
next
Fic.writeLine "E"
Fic.Close
Set Fic = Nothing
Set fso = Nothing
end if
%> |