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

PHP & Base de données Discussion :

exportation oracle php vers Excel


Sujet :

PHP & Base de données

  1. #1
    Candidat au Club
    Inscrit en
    Avril 2007
    Messages
    3
    Détails du profil
    Informations forums :
    Inscription : Avril 2007
    Messages : 3
    Points : 4
    Points
    4
    Par défaut exportation oracle php vers Excel
    je veut exportée les données de la base oracle vers un fichier Excel à travers PHP.

  2. #2
    Membre du Club
    Profil pro
    Inscrit en
    Mai 2005
    Messages
    40
    Détails du profil
    Informations personnelles :
    Âge : 44
    Localisation : France, Rhône (Rhône Alpes)

    Informations forums :
    Inscription : Mai 2005
    Messages : 40
    Points : 48
    Points
    48
    Par défaut fichier excel
    Je ne sais pas si le pb est le fait que se soit oracle ou qu'il faille créer un fichier excel.
    Pour le fichier excel, voici un exemple
    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
     
    //=============================================================
    // Création du fichier Excel
    //=============================================================
    $date = date("YmdHis", mktime());
    $filename = "./path/" . $logon_user . "_" . $date;
    $sheetname = $logon_user . "_" . $date;
    $fp = fopen($filename . ".xls", "a");
     
    //--- un peu de xml pour la mise en page (orientation, figer les volets)
    fwrite($fp, "
    <html xmlns:o=\"urn:schemas-microsoft-com:office:office\"
    xmlns:x=\"urn:schemas-microsoft-com:office:excel\"
    xmlns=\"http://www.w3.org/TR/REC-html40\">
    <head>
    <meta http-equiv=Content-Type content=\"text/html; charset=windows-1252\">
    <meta name=ProgId content=Excel.Sheet>
    <meta name=Generator content='" . $app_name . "'>
    <style>
    <!--table
    	{mso-displayed-decimal-separator:\"\,\";
    	mso-displayed-thousand-separator:\" \";}
    @page
    	{margin:.39in .39in .39in .39in;
    	mso-header-margin:.39in;
    	mso-footer-margin:.39in;
    	mso-page-orientation:landscape;}
    -->
    </style>
    <!--[if gte mso 9]><xml>
     <x:ExcelWorkbook>
      <x:ExcelWorksheets>
       <x:ExcelWorksheet>
        <x:Name>" . $sheetname . "</x:Name>
        <x:WorksheetOptions>
         <x:DefaultColWidth>10</x:DefaultColWidth>
         <x:Print>
          <x:ValidPrinterInfo/>
          <x:PaperSizeIndex>9</x:PaperSizeIndex>
          <x:HorizontalResolution>600</x:HorizontalResolution>
          <x:VerticalResolution>600</x:VerticalResolution>
         </x:Print>
         <x:Selected/>
         <x:DoNotDisplayGridlines/>
         <x:FreezePanes/>
         <x:FrozenNoSplit/>
         <x:SplitHorizontal>1</x:SplitHorizontal>
         <x:TopRowBottomPane>1</x:TopRowBottomPane>
         <x:SplitVertical>1</x:SplitVertical>
         <x:LeftColumnRightPane>1</x:LeftColumnRightPane>
         <x:ActivePane>0</x:ActivePane>
         <x:ProtectContents>False</x:ProtectContents>
         <x:ProtectObjects>False</x:ProtectObjects>
         <x:ProtectScenarios>False</x:ProtectScenarios>
        </x:WorksheetOptions>
       </x:ExcelWorksheet>
      </x:ExcelWorksheets>
      <x:WindowHeight>9780</x:WindowHeight>
      <x:WindowWidth>15240</x:WindowWidth>
      <x:WindowTopX>0</x:WindowTopX>
      <x:WindowTopY>1230</x:WindowTopY>
      <x:ProtectStructure>False</x:ProtectStructure>
      <x:ProtectWindows>False</x:ProtectWindows>
     </x:ExcelWorkbook>
    </xml><![endif]-->
    </head>
    <body link=blue vlink=purple>
       ");
    //=============================================================
    // Affichage de la table
    //=============================================================
    <table>......
    </table>
    //=============================================================
    // Ouverture du fichier Excel
    //=============================================================
    echo "<script>$n";
    echo "  window.open('http:" . $filename . ".xls','','left=0,top=0,width=screen.width,height=screen.height,resizable,scrollbars=1,menubar=1,toolbar=1,location=0,status=0');$n";
    echo "  history.back();$n";
    echo "</script>$n";

  3. #3
    Membre habitué Avatar de scorpking
    Profil pro
    Inscrit en
    Avril 2006
    Messages
    232
    Détails du profil
    Informations personnelles :
    Âge : 37
    Localisation : France

    Informations forums :
    Inscription : Avril 2006
    Messages : 232
    Points : 181
    Points
    181
    Par défaut
    heu je n'ai pas compris si tu veux creerune base exel a partir d'une base oracle ou alor exporter sous forme de tableau exel les reponses à ta requete (méthode de deruy si j'ai bien compris son source)

Discussions similaires

  1. PHP vers Excel - Données à exporter
    Par baggie dans le forum Langage
    Réponses: 2
    Dernier message: 05/05/2010, 11h05
  2. [ODBC] export php vers Excel probleme de colonne
    Par nawak.seb dans le forum PHP & Base de données
    Réponses: 1
    Dernier message: 12/02/2009, 12h06
  3. [MySQL] Exporter des données vers Excel depuis php
    Par berti dans le forum PHP & Base de données
    Réponses: 4
    Dernier message: 05/03/2008, 14h26
  4. Exportation HTML/PHP vers fichier Excel existant
    Par fthem dans le forum EDI, CMS, Outils, Scripts et API
    Réponses: 5
    Dernier message: 10/01/2008, 15h07

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