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

 Delphi Discussion :

paradox ver xls


Sujet :

Delphi

  1. #1
    Membre habitué
    Profil pro
    Inscrit en
    Novembre 2004
    Messages
    483
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2004
    Messages : 483
    Points : 128
    Points
    128
    Par défaut paradox ver xls
    salut tous
    un petit conseil je ne trouve rien sur l'export paradox ver excel (fichier XLS)
    vous avez un tuto ou un petit exemple svp.
    voila j'ai une table client paradox et j'aimerais faire deux choses
    exporter le nom et prenom de mes adhérants dans un fichier XLS
    et
    exporter le nom et prenom de mes adhérants dans un fichier TXT

    merci de votre aide

  2. #2
    Membre chevronné Avatar de philnext
    Profil pro
    Inscrit en
    Octobre 2002
    Messages
    1 552
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2002
    Messages : 1 552
    Points : 1 780
    Points
    1 780
    Par défaut
    La même chose, dont tu peux t'inspirer, à partir d'un fichier MDB :

    http://sourceforge.net/projects/axbase

  3. #3
    Membre habitué
    Profil pro
    Inscrit en
    Novembre 2004
    Messages
    483
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2004
    Messages : 483
    Points : 128
    Points
    128
    Par défaut merci a toi
    Citation Envoyé par philnext Voir le message
    La même chose, dont tu peux t'inspirer, à partir d'un fichier MDB :

    http://sourceforge.net/projects/axbase
    merci mais cela ne correspond pas a se que je voudrais et le stable paradox sont extension .DB

  4. #4
    Membre chevronné Avatar de philnext
    Profil pro
    Inscrit en
    Octobre 2002
    Messages
    1 552
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2002
    Messages : 1 552
    Points : 1 780
    Points
    1 780
    Par défaut
    Le principe est exactement le même quelque soit la base de données !
    Tu as une fonction SaveAsExcelFile qui exporte en XLS un TDataSet.
    Si ce n'est pas ce que tu recherches...

  5. #5
    Membre actif
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Janvier 2008
    Messages
    241
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Algérie

    Informations professionnelles :
    Activité : Développeur .NET
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Janvier 2008
    Messages : 241
    Points : 204
    Points
    204
    Par défaut
    voilà tu peut utiliser ça
    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
    procedure TForm1.Button1Click(Sender: TObject);
    var rangeE: variant;
        i,row:integer;
        bookmark:Tbookmarkstr;
        table:tdataset;
     
    begin
       //créer et rendre visible excel
       table:=dbgrid1.datasource.dataset;
       ExcelApplication1.Visible[0]:=true;
       excelapplication1.workbooks.add(NULL,0);
       //remplir la première ligne avec les noms des champs
       rangeE:=ExcelApplication1.ActiveCell;
       for i:=0 to table.Fields.Count-1 do
       begin
       rangeE.Value:=table.Fields[i].DisplayLabel;
       rangeE:=rangeE.Next;
       end;
       rangeE.AutoFormat(10,NULL,NULL,NULL,NULL,NULL,NULL);
       //remplir les lignes suivantes avec les enregts.
       table.DisableControls;
       try
        bookmark:=table.Bookmark;
        try
         table.First;
         row:=2;//table.RecordCount+1;
         while not table.Eof do
         begin
           rangeE:=ExcelApplication1.Range['A'+inttostr(Row), 'A'+inttostr(Row)];
           for i:=0 to table.Fields.Count-1 do
           begin
             rangeE.Value:=table.Fields[i].AsString;
             rangeE:=RangeE.Next;
           end;
           table.Next;
           Inc(row);
         end;
         finally
          table.Bookmark:=bookmark;
         end;
         finally
          table.EnableControls;
         end;
         //formater le tableau pour que  cela fasse joli
         //rangeE:=ExcelApplication1.Range['A1','E'+inttostr(row-1)];
        // rangeE.AutoFormat(3,NULL,NULL,NULL,NULL,NULL,NULL);
     
     
     
    end;
     
    end.

  6. #6
    Membre chevronné Avatar de philnext
    Profil pro
    Inscrit en
    Octobre 2002
    Messages
    1 552
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2002
    Messages : 1 552
    Points : 1 780
    Points
    1 780
    Par défaut
    Citation Envoyé par sam83 Voir le message
    voilà tu peut utiliser ça
    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
    procedure TForm1.Button1Click(Sender: TObject);
    var rangeE: variant;
        i,row:integer;
        bookmark:Tbookmarkstr;
        table:tdataset;
     
    begin
       //créer et rendre visible excel
       table:=dbgrid1.datasource.dataset;
       ExcelApplication1.Visible[0]:=true;
       excelapplication1.workbooks.add(NULL,0);
       //remplir la première ligne avec les noms des champs
       rangeE:=ExcelApplication1.ActiveCell;
       for i:=0 to table.Fields.Count-1 do
       begin
       rangeE.Value:=table.Fields[i].DisplayLabel;
       rangeE:=rangeE.Next;
       end;
       rangeE.AutoFormat(10,NULL,NULL,NULL,NULL,NULL,NULL);
       //remplir les lignes suivantes avec les enregts.
       table.DisableControls;
       try
        bookmark:=table.Bookmark;
        try
         table.First;
         row:=2;//table.RecordCount+1;
         while not table.Eof do
         begin
           rangeE:=ExcelApplication1.Range['A'+inttostr(Row), 'A'+inttostr(Row)];
           for i:=0 to table.Fields.Count-1 do
           begin
             rangeE.Value:=table.Fields[i].AsString;
             rangeE:=RangeE.Next;
           end;
           table.Next;
           Inc(row);
         end;
         finally
          table.Bookmark:=bookmark;
         end;
         finally
          table.EnableControls;
         end;
         //formater le tableau pour que  cela fasse joli
         //rangeE:=ExcelApplication1.Range['A1','E'+inttostr(row-1)];
        // rangeE.AutoFormat(3,NULL,NULL,NULL,NULL,NULL,NULL);
     
     
     
    end;
     
    end.
    Oui mais il me semble que pour ça tu as besoin d'Excel sur la machine, non ?

  7. #7
    Membre habitué
    Profil pro
    Inscrit en
    Novembre 2004
    Messages
    483
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2004
    Messages : 483
    Points : 128
    Points
    128
    Par défaut merci
    Citation Envoyé par sam83 Voir le message
    voilà tu peut utiliser ça
    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
    procedure TForm1.Button1Click(Sender: TObject);
    var rangeE: variant;
        i,row:integer;
        bookmark:Tbookmarkstr;
        table:tdataset;
     
    begin
       //créer et rendre visible excel
       table:=dbgrid1.datasource.dataset;
       ExcelApplication1.Visible[0]:=true;
       excelapplication1.workbooks.add(NULL,0);
       //remplir la première ligne avec les noms des champs
       rangeE:=ExcelApplication1.ActiveCell;
       for i:=0 to table.Fields.Count-1 do
       begin
       rangeE.Value:=table.Fields[i].DisplayLabel;
       rangeE:=rangeE.Next;
       end;
       rangeE.AutoFormat(10,NULL,NULL,NULL,NULL,NULL,NULL);
       //remplir les lignes suivantes avec les enregts.
       table.DisableControls;
       try
        bookmark:=table.Bookmark;
        try
         table.First;
         row:=2;//table.RecordCount+1;
         while not table.Eof do
         begin
           rangeE:=ExcelApplication1.Range['A'+inttostr(Row), 'A'+inttostr(Row)];
           for i:=0 to table.Fields.Count-1 do
           begin
             rangeE.Value:=table.Fields[i].AsString;
             rangeE:=RangeE.Next;
           end;
           table.Next;
           Inc(row);
         end;
         finally
          table.Bookmark:=bookmark;
         end;
         finally
          table.EnableControls;
         end;
         //formater le tableau pour que  cela fasse joli
         //rangeE:=ExcelApplication1.Range['A1','E'+inttostr(row-1)];
        // rangeE.AutoFormat(3,NULL,NULL,NULL,NULL,NULL,NULL);
     
     
     
    end;
     
    end.
    j'ai une erreur ici
    ExcelApplication1.Visible[0]:=true;
    identificateur non déclarer ?

  8. #8
    Membre actif
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Janvier 2008
    Messages
    241
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Algérie

    Informations professionnelles :
    Activité : Développeur .NET
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Janvier 2008
    Messages : 241
    Points : 204
    Points
    204
    Par défaut
    Oui effectivement;
    mais a ce que vous voulez exporter vers excel sans que ce dernier soit installé sur la machine?

  9. #9
    Membre actif
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Janvier 2008
    Messages
    241
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Algérie

    Informations professionnelles :
    Activité : Développeur .NET
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Janvier 2008
    Messages : 241
    Points : 204
    Points
    204
    Par défaut
    a ce que l'ajouté le composant ExcelApplication sur ta form sinon tu peut nous donnés l'erreur complète

  10. #10
    Membre habitué
    Profil pro
    Inscrit en
    Novembre 2004
    Messages
    483
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Novembre 2004
    Messages : 483
    Points : 128
    Points
    128
    Par défaut super
    Citation Envoyé par sam83 Voir le message
    a ce que l'ajouté le composant ExcelApplication sur ta form sinon tu peut nous donnés l'erreur complète
    une derniere petite chose si je veux uniquement le nom et prenom je fais comment ?

  11. #11
    Membre actif
    Homme Profil pro
    Développeur .NET
    Inscrit en
    Janvier 2008
    Messages
    241
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : Algérie

    Informations professionnelles :
    Activité : Développeur .NET
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Janvier 2008
    Messages : 241
    Points : 204
    Points
    204
    Par défaut
    bon pour remplir la première ligne avec les noms des champs en fait ça
    rangeE:=ExcelApplication1.ActiveCell;
    for i:=0 to table.Fields.Count-1 do
    begin
    rangeE.Value:=table.Fields[i].DisplayLabel;
    rangeE:=rangeE.Next;
    end;
    rangeE.AutoFormat(10,NULL,NULL,NULL,NULL,NULL,NULL);
    donc pour remplir tout les champs la variable "i" va aller de 0 jusqu'à "table.Fields.Count-1" maintenant pour remplir quelque champs il suffit d'ajust le compteur
    exemple:pour remplir les deux premier champs en fait
    for i:=0 to 1 do

Discussions similaires

  1. Exporter PDF vers XLS
    Par Jaggana dans le forum C
    Réponses: 7
    Dernier message: 11/04/2006, 16h23
  2. Migration Paradox vers Firebird 1.5
    Par breiz35 dans le forum Débuter
    Réponses: 11
    Dernier message: 15/03/2006, 12h06
  3. [VBA-E].txt vers .xls
    Par Empty_body dans le forum Macros et VBA Excel
    Réponses: 14
    Dernier message: 08/02/2006, 14h46
  4. transferer les donnees d'une BD paradox vers access
    Par denza1 dans le forum Bases de données
    Réponses: 5
    Dernier message: 31/10/2004, 14h14

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