je veut exportée les données de la base oracle vers un fichier Excel à travers PHP.
Version imprimable
je veut exportée les données de la base oracle vers un fichier Excel à travers PHP.
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:
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";
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)