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

ASP Discussion :

Ouvrire ou Enregistrer un Fichier Excel


Sujet :

ASP

  1. #1
    Nouveau membre du Club
    Inscrit en
    Mars 2005
    Messages
    41
    Détails du profil
    Informations forums :
    Inscription : Mars 2005
    Messages : 41
    Points : 31
    Points
    31
    Par défaut Ouvrire ou Enregistrer un Fichier Excel
    Bonjour

    J'ai beaucoup chercher sa vraiment avoir de réponse.
    Ce que je cherche c'est comment ouvrir ou enregistrer un fichier (word,excel,...)

    Merci beaucoup

  2. #2
    Nouveau membre du Club
    Inscrit en
    Mars 2005
    Messages
    41
    Détails du profil
    Informations forums :
    Inscription : Mars 2005
    Messages : 41
    Points : 31
    Points
    31
    Par défaut
    J'ai trouvé
    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
     
    <%@Language="VBScript"%>  
    <%Option Explicit%>  
    <%Response.Buffer = True%>  
    <%  
     On Error Resume Next  
     Dim strPath,nom
     strPath = CStr(Request.QueryString("ref")) 
     nom = Request.QueryString("name")  
      '-- do some basic error checking for the QueryString   
     
     
    If strPath = "" Then  
         Response.Clear  
         Response.Write("No file specified.")  
         Response.End  
     ElseIf InStr(strPath, "..") > 0 Then  
         Response.Clear  
         Response.Write("Illegal folder location.")  
         Response.End  
     ElseIf Len(strPath) > 1024 Then  
         Response.Clear  
         Response.Write("Folder path too long.")  
         Response.End  
     Else  
         Call DownloadFile(strPath)  
     End If  
     
    Private Sub DownloadFile(file)  
         '--declare variables  
         Dim strAbsFile  
         Dim strFileExtension  
         Dim objFSO  
         Dim objFile  
         Dim objStream  
         '-- set absolute file location  
         strAbsFile = file  
         '-- create FSO object to check if file exists and get properties  
         Set objFSO = Server.CreateObject("Scripting.FileSystemObject")  
         '-- check to see if the file exists  
         If objFSO.FileExists(strAbsFile) Then  
             Set objFile = objFSO.GetFile(strAbsFile)  
             '-- first clear the response, and then set the appropriate headers  
             Response.Clear  
             '-- the filename you give it will be the one that is shown  
             ' to the users by default when they save  
             Response.AddHeader "Content-Disposition", "attachment; filename=" & nom
             Response.AddHeader "Content-Length", objFile.Size  
             Response.ContentType = "application/octet-stream"  
             Set objStream = Server.CreateObject("ADODB.Stream")  
             objStream.Open  
             '-- set as binary  
             objStream.Type = 1  
             Response.CharSet = "UTF-8"  
             '-- load into the stream the file  
             objStream.LoadFromFile(strAbsFile)  
             '-- send the stream in the response  
             Response.BinaryWrite(objStream.Read)  
             objStream.Close  
             Set objStream = Nothing  
             Set objFile = Nothing  
         Else 'objFSO.FileExists(strAbsFile)  
             Response.Clear  
             Response.Write("No such file exists.")  
         End If  
         Set objFSO = Nothing  
     End Sub 
    %>
    Merci quand même

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

Discussions similaires

  1. Réponses: 3
    Dernier message: 02/04/2007, 21h52
  2. [VBA-E] une macro qui enregistre mon fichier Excel
    Par Djohn dans le forum Macros et VBA Excel
    Réponses: 10
    Dernier message: 02/03/2007, 11h47
  3. [VBA]enregistrer en fichier excel en macro
    Par jazziestan dans le forum SDK
    Réponses: 12
    Dernier message: 29/12/2006, 10h07
  4. [Excel] Enregistrer un fichier Excel côté client
    Par scorpking dans le forum Bibliothèques et frameworks
    Réponses: 14
    Dernier message: 18/07/2006, 11h10
  5. [VB] Ouvrir et modifier un fichier Excel en arrière-fond
    Par truman dans le forum Macros et VBA Excel
    Réponses: 5
    Dernier message: 14/04/2006, 18h49

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