0
A
回答
1
這將是非常困難的產生的Excel文件,而是一個CSV文件將是容易建立:
field1,field2,field3
value1,value2,value3
value1,value2,value3
產生它的JavaScript,併發送作爲下載使用Downloadify:
Downloadify是一個小小的JavaScript + Flash庫,可以生成和保存fi在飛行中,在瀏覽器中,無需服務器交互。
1
Click Here使用電子表格文檔,我們可以使用JavaScript 只要按照文件,並添加語法 你參考上面的XML this
'<?xml version="1.0"?>',
'<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40">',
'<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office"><Title>' + theTitle + '</Title></DocumentProperties>',
'<OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office"><AllowPNG/></OfficeDocumentSettings>',
'<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">',
'<WindowHeight>' + worksheet.height + '</WindowHeight>',
'<WindowWidth>' + worksheet.width + '</WindowWidth>',
'<ProtectStructure>False</ProtectStructure>',
'<ProtectWindows>False</ProtectWindows>',
'</ExcelWorkbook>',
'<Styles>',
'<Style ss:ID="Default" ss:Name="Normal">',
'<Alignment ss:Vertical="Bottom"/>',
'<Borders/>',
'<Font ss:FontName="Calibri" x:Family="Swiss" ss:Size="12" ss:Color="#000000"/>',
'<Interior/>',
'<NumberFormat/>',
'<Protection/>',
'</Style>',
'<Style ss:ID="title">',
'<Borders />',
'<Font ss:Bold="1" ss:Size="18" />',
'<Alignment ss:Horizontal="Center" ss:Vertical="Center" ss:WrapText="1" />',
'<NumberFormat ss:Format="@" />',
'</Style>',
'<Style ss:ID="headercell">',
'<Font ss:Bold="1" ss:Size="10" />',
'<Alignment ss:Horizontal="Center" ss:WrapText="1" />',
'<Interior ss:Color="#A3C9F1" ss:Pattern="Solid" />',
'</Style>',
'<Style ss:ID="even">',
'<Interior ss:Color="#CCFFFF" ss:Pattern="Solid" />',
'</Style>',
'<Style ss:ID="evendate" ss:Parent="even">',
'<NumberFormat ss:Format="yyyy-mm-dd" />',
'</Style>',
'<Style ss:ID="evenint" ss:Parent="even">',
'<Numberformat ss:Format="0" />',
'</Style>',
'<Style ss:ID="evenfloat" ss:Parent="even">',
'<Numberformat ss:Format="0.00" />',
'</Style>',
'<Style ss:ID="odd">',
'<Interior ss:Color="#CCCCFF" ss:Pattern="Solid" />',
'</Style>',
'<Style ss:ID="groupSeparator">',
'<Interior ss:Color="#D3D3D3" ss:Pattern="Solid" />',
'</Style>',
'<Style ss:ID="odddate" ss:Parent="odd">',
'<NumberFormat ss:Format="yyyy-mm-dd" />',
'</Style>',
'<Style ss:ID="oddint" ss:Parent="odd">',
'<NumberFormat Format="0" />',
'</Style>',
'<Style ss:ID="oddfloat" ss:Parent="odd">',
'<NumberFormat Format="0.00" />',
'</Style>
'</Styles>
worksheet.xml,
'</Workbook>'
而且atlast編碼爲base64,形成一個數據鏈接開始動態地創建電子表格with'data:application/vnd.ms-excel; base64,{base64 encoded above xml}
Atlast它可能看起來像這樣請點擊這裏下載excel enter code here
相關問題
- 1. Javascript庫生成excel文件
- 2. 從javascript生成office open XML excel文件
- 3. 如何從JavaScript生成Excel xlsx文件
- 4. 使用PHPExcel從MYSQL生成Excel文件
- 5. 如何使用js生成excel文件
- 6. 使用JScript生成Excel文件
- 7. 下載生成後生成excel文件
- 8. 使用javascript生成Excel代碼
- 9. JSON文件生成使用Javascript串行
- 10. 使用PHP生成Javascript文件
- 11. 生成Excel文件與VB6
- 12. Playframework Excel文件生成
- 13. 從HTML生成Excel文件
- 14. 使用excel生成word文件在excel同一目錄中vba
- 15. 無法打開使用excel庫生成的excel文件
- 16. 將數據插入Excel使用Excel生成的文件PIA的
- 17. 如何使用C#從Word/Excel文件生成PDF文件?
- 18. 使用郵件合併從excel文件生成word文檔
- 19. 從excel文件生成mxml文件
- 20. 從Excel文件生成.rdl文件
- 21. 使用Ruby生成Excel文檔
- 22. 使用ASP.NET生成Excel文檔網站
- 23. 生成使用Javascript
- 24. 如何使用ASP Web應用程序生成MS-Excel文件?
- 25. 從excel文件模板生成自定義excel文件
- 26. PHP/Javascript生成和自動下載excel文件
- 27. 在JavaScript中,我如何使用Dart生成的JavaScript文件?
- 28. 如何用Jade生成純JavaScript文件
- 29. 使用qmake生成具有FLTK fluild文件的生成文件?
- 30. 生成EXCEL文件輸出在Java中
可能重複的[如何通過Javascript生成Excel](http://stackoverflow.com/questions/333537/how-to-generate-excel-through-javascript) – Oddthinking 2010-07-05 05:47:11
爲什麼不只是做一個ajax調用呢? – Gogol 2015-03-02 10:30:01