Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

java µ¼³öexcel·½·¨

µ½http://download.csdn.net/source/1781433ÏÂÔØjxl.jarÎļþ
/*TitleÊDZ£´æ³öÀ´µÄÎļþÃû£¬gbl_LastOpenPathÓÃÓڼǼÉϴδò¿ªµÄ·¾¶*/
public void ExportToExcel(JTable table, String Title){
File DefaultFile;
JFileChooser fc = new JFileChooser();
File file;
if(gbl_LastOpenPath!=null){
DefaultFile = new File(gbl_LastOpenPath+"/"+Title+".xls");
if(DefaultFile.exists()){
//fc.setSelectedFile(DefaultFile);
// fc.setCurrentDirectory(DefaultFile); //ÉèÖôò¿ªµÄĬÈÏ·¾¶
fc.setSelectedFile(DefaultFile);
}
}
if(gbl_LastOpenPath==null){
//String s = System.getProperty("user.dir");
fc.setSelectedFile(new File("c:/"+Title+".xls"));
}
int Selection = fc.showDialog(this, null);
fc.setVisible(true);
if(Selection==0){
file = fc.getSelectedFile();
gbl_LastOpenPath = file.getParent();
/*¿ªÊ¼µ¼³öÊý¾Ý*/
try {
WritableWorkbook book = Workbook.createWorkbook(file);
WritableSheet sheet=book.createSheet(Title,0); //¹¤×÷±íÃû³Æ
sheet.mergeCells(0,0,(table.getColumnCount()-1),0); //ºÏ²¢µÚÒ»ÐÐ
/*±íÍ·£º¼Ó´Ö*/
WritableFont CaptionFont = new WritableFont(WritableFont.ARIAL, 14,WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
/*±íÍ·£º¾ÓÖÐ*/
WritableCellFormat CatpionStyle = new WritableCellFormat(CaptionFont);
CatpionStyle.setAlignment(Alignment.CENTRE);
CatpionStyle.setVerticalAlignment(VerticalAlignment.CENTRE);
sheet.addCell(new Label(0,0,Title,CatpionStyle));
/*д±íÍ·*/
WritableFont TitleFont = new WritableFont(WritableFont.ARIAL, 10,WritableFont.BOLD, false, UnderlineStyle.NO_UNDERLINE,Colour.BLACK);
/*±íÍ·£º¾ÓÖÐ*


Ïà¹ØÎĵµ£º

JAVA¼¯ºÏ

Vector : »ùÓÚArrayµÄList£¬Æäʵ¾ÍÊÇ·â×°ÁËArrayËù²»¾ß±¸µÄһЩ¹¦ÄÜ·½±ãÎÒÃÇʹÓã¬Ëü²»¿ÉÄÜ×ßÈëArrayµÄÏÞÖÆ¡£ÐÔÄÜÒ²¾Í²»¿ÉÄÜ
³¬Ô½Array¡£ËùÒÔ£¬ÔÚ¿ÉÄܵÄÇé¿öÏ£¬ÎÒÃÇÒª¶àÔËÓÃArray¡£ÁíÍâºÜÖØÒªµÄÒ»µã¾ÍÊÇVector“sychronized”µÄ£¬Õâ¸öÒ²ÊÇVectorºÍ
ArrayListµÄΨһµÄÇø±ð¡£
ArrayList£ºÍ¬VectorÒ»ÑùÊÇÒ»¸ö»ùÓ ......

javaÀàÐÍѧϰ


Ò»¸öjavaÎļþÖУ¬ÓÐÇÒÖ»ÓÐÒ»¸öpublicÀà
float ff= 1.3f;(4B)
int 4B;
long 8B;
double 8B;
byte Ò»×Ö½ÚÕûÐÍ
char 2B
Êý×é
int num[] = new int[3];
int[] num;
num = new int[3];
int [] num = new int[]{1,2,3};
int [][] num;
num = new int[3][4];
//²»Í¬³¤
num = new int[3][];
num[0] = new int[5]; ......

JAVA´¦ÀíÈÕÆÚʱ¼ä³£Ó÷½·¨


Calendar ÀàÊÇÒ»¸ö³éÏóÀ࣬ËüΪÌض¨Ë²¼äÓëÒ»×éÖîÈç YEAR¡¢MONTH¡¢DAY_OF_MONTH¡¢HOUR µÈ ÈÕÀú×Ö¶ÎÖ®¼äµÄת»»ÌṩÁËһЩ·½·¨£¬²¢Îª²Ù×÷ÈÕÀú×ֶΣ¨ÀýÈç»ñµÃÏÂÐÇÆÚµÄÈÕÆÚ£©ÌṩÁËһЩ·½·¨¡£Ë²¼ä¿ÉÓúÁÃëÖµÀ´±íʾ£¬ËüÊǾàÀúÔª£¨¼´¸ñÁÖÍþÖαê׼ʱ¼ä 1970 Äê 1 Ô 1 ÈÕµÄ 00:00:00.000£¬¸ñÀï¸ßÀûÀú£©µÄÆ«ÒÆÁ¿¡£
Àý:
Calenda ......

JavaʵÏÖ¶ÓÁвÙ×÷


import java.util.LinkedList;  
//µ¥Ïò¶ÓÁР 
public class Queue {  
    public Queue() {  
    }  
    private LinkedList list = new LinkedList();  
    public void pu ......

java¸ñʽ»¯Êä³ö

 importjava.text.DecimalFormat;
¡¡¡¡
publicclassTestNumberFormat{
¡¡¡¡
¡¡¡¡publicstaticvoidmain(String[]args){
¡¡¡¡¡¡¡¡doublepi=3.1415927;¡¡//Ô²ÖÜÂÊ
¡¡¡¡¡¡¡¡//ȡһλÕûÊý
¡¡¡¡¡¡¡¡System.out.println(newDecimalFormat("0").format(pi));¡¡¡¡¡¡//3
¡¡¡¡¡¡¡¡//ȡһλÕûÊýºÍÁ½Î»Ð¡Êý
¡¡¡¡¡¡¡¡System ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ