flex ǰ̨µ¼³öExcel
/**=========main.mxml=========*/
/* µ¼³öexcel */
private function exp():void{
if(dgEnterprise.dataProvider==null){
Alert.show("Êý¾ÝΪ¿Õ£¬ÎÞ·¨µ¼³öexcel","ÓÑÇéÌáʾ");
}else{
ExportExccel.loadDGInExcel(dgEnterprise,"/ssfxSystem/excelexport.jsp?tableName=ÆóÒµÐÅÏ¢");
}
}
/**=========excelexport.jsp=========*/
<%@page import="java.util.Date"%>
<%@page import="java.text.SimpleDateFormat"%><%@ page language="java"%>
<%@ page contentType="application/msexcel;charset=UTF-8"
pageEncoding="UTF-8"%>
<%
request.setCharacterEncoding("UTF-8");
String name="";
if (request.getParameter("tableName") != null) {
name = request.getParameter("tableName");
} else {
name = "report";
}
SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd");
Date d1 = new Date();
String date = formatter.format(d1);
response.setHeader("Content-disposition", "attachment; filename="
+" "+name+ "-" + date + ".xls");
String str = request.getParameter("htmltable");
out.print(str);
%>
/**=========ExportExcel.as=========*/
package utils
{
import flash.errors.*;
import flash.events.*;
import flash.external.*;
import flash.net.URLRequest;
import flash.net.URLRequestMethod;
import flash.net.URLVariables;
import flash.net.navigateToURL;
import mx.controls.DataGrid;
public class ExportExccel
{
public function ExportExccel()
{
}
private static function convertDGToHTMLTable(dg:DataGrid):String {
//Set default values
var font:String = dg.getStyle('fontFamily');
var size:String = dg.getStyle('fontSize');
var str:String = '';
var colors:String = '';
var style:String = 'style="font-family:'+font+';font-size:'+size+'pt;"';
var hcolor:Array;
//Retrieve the headercolor
if(dg.getStyle("headerColor") != undefined) {
hcolor = [dg.getStyle("headerColor")];
} else {
hcolor = dg.getStyle("headerColors");
}
//Set the htmlta
Ïà¹ØÎĵµ£º
ÓÃÁËÁ½Ììʱ¼äѧϰÁËÏÂFlexºÍjavaÅäºÏʵÏÖÎļþÉÏ´«£¬ÕÒÁ˸öСÀý×Ó¡£Ç°¶Ëµ±È»ÊÇflex£¬ºǫ́ʹÓÃservlet£¬°Ñ´úÂëÌùÉÏÀ´£¬±¸Íü°É£º
FileUpload.java:
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Iterator;
import java.util.List;
import javax.servlet.ServletExc ......
¹ØÓÚFlex»òFlashµÄ¿çÓò·ÃÎʵĽâ¾ö·½°¸£¬ÊÂÇéµÄÆðÒòÊÇ£¬ÓÉÎÒ¹«¿ªµÄÒ»¸öwebservice£¨²»Çå³þÕâ¸öwebservice¸ÉʲôµÄÇë¿´ÕâÀ¿ªÊ¼µÄ£¬kenshinµÄÅóÓÑsensunÔÚÕâ¸ö¹«¿ªµÄwebserviceµÄ»ù´¡ÉÏÖÆ×÷ÁËÒ»¸öweather²éѯµÄ£¬ÔÚ±¾»ú²âÊÔok£¬Ò»Äõ½ÍøÉÏ£¬¾Í»á³öÏÖerror£¨ÊÇ¿çÓò·ÃÎʵĴíÎ󣩣¬ºóÀ´£¬kenshinÖÕÓÚÕÒµ½ÁËÕâ¸öÎÊÌâµÄ½â¾ö·½° ......
1. chart£º×ÜÌå¿ØÖÆ
2.
series£º¶¨ÒåʲôÑùµÄÊý¾ÝÀ´Õ¹Ê¾£¬x,yÖá·Ö±ðÏÔʾʲôÊý¾Ý¡£ËüÊÇ°üº¬ÏàÓ¦µÄseriesItemµÄArray¡£SeriesItem·â×°Á˼«Öµ
µã£¬Ìî³ä·½Ê½£¬xyÊý¾ÝµÈ¡£
3. series ÖÐdisplayNameÊôÐÔ¿ ......
±¾ÆªÎÄÕÂÊÇ¡¶Flash Builder 4 beta (Gumbo) UI¡¢¹¦ÄܵÄÐÂÌåÑé¡·µÚÈýƪÎÄÕ£¬×ÅÖؽéÉܵÄFlex SDK 4(Gumbo)ÐÂÔö¼ÓµÄÃüÃû¿Õ¼ä£¨NameSpace£©¡£
ÖÚËùÖÜÖª£¬Flex SDK 4(Gumbo)Ôö¼ÓÁËһЩÃüÃû¿Õ¼ä£¬Çë¿´ÈçÏ£º
xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:mx="library://ns.adobe.com/flex/halo"
xmlns:s="library://ns.a ......