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 xlsx文件
- 2. 从javascript生成office open XML excel文件
- 3. JSON文件生成使用Javascript串行
- 4. 生成Excel文件与VB6
- 5. 使用邮件合并从excel文件生成word文档
- 6. 如何使用C#从Word/Excel文件生成PDF文件?
- 7. 从Excel文件生成.rdl文件
- 8. 生成使用Javascript
- 9. 如何使用ASP Web应用程序生成MS-Excel文件?
- 10. 从excel文件模板生成自定义excel文件
- 11. 使用qmake生成具有FLTK fluild文件的生成文件?
- 12. 从iReport生成的Excel文件
- 13. VBA - 从访问生成Excel文件(QueryTable)
- 14. 标题不工作生成excel文件...?
- 15. SSIS C#OpenXML生成Excel文件失败
- 16. 生成Excel文件时出错
- 17. 生成并下载excel文件
- 18. 导入Excel中生成的xml文件
- 19. 使用PHP生成并发送excel文件
- 20. 如何使用SSIS从sql表中生成excel文件?
- 21. 在ASP.NET中使用Excel生成PDF文件时出错
- 22. 使用ajax下载生成的excel文件
- 23. 在IIS7.5上使用ASP生成Excel文件
- 24. 使用php生成并发送Excel文件
- 25. VBA:在Matlab生成的Excel文件中使用函数
- 26. 使用PHPExcel制作自动生成的Excel文件
- 27. 如何使用PHP生成密码保护的Excel文件?
- 28. 如何在PHP中使用Autofilters生成Excel文件?
- 29. 使用PhpExcel生成包含多个工作表的Excel文件
- 30. 使用Doxygen生成JavaScript文档
可能重复的[如何通过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