Java½âÊÍExcelÊý¾Ý£¨jxl.jar°üµÄʹÓã©
»ù±¾²Ù×÷
Ò»¡¢´´½¨Îļþ
ÄâÉú³ÉÒ»¸öÃûΪ“²âÊÔÊý¾Ý.xls”µÄExcelÎļþ£¬ÆäÖеÚÒ»¸ö¹¤×÷±í±»ÃüÃûΪ“µÚÒ»Ò³”£¬´óÖÂЧ¹ûÈçÏ£º
/*
* Created on Dec 30, 2007
*
* To change the template for this generated file go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
package JExcelTest.standard;
import java.io.*;
import jxl.*;
import jxl.write.*;
/**
* @author Ken
*
* To change the template for this generated type comment go to
* Window>Preferences>Java>Code Generation>Code and Comments
*/
public class CreateXLS {
public static void main(String[] args) {
try {
//open file.
WritableWorkbook book = Workbook.createWorkbook(new File("d:/Test.xls"));
//create Sheet named "Sheet_1". 0 means this is 1st page.
WritableSheet sheet = book.createSheet("Sheet_1", 0);
//define cell column and row in Label Constructor, and cell content write "test".
//cell is 1st-Column,1st-Row. value is "test".
Label label = new Label(0, 0, "test");
//add defined cell above to sheet instance.
sheet.addCell(label);
//create cell using add numeric. WARN:necessarily use integrated package-path, otherwise will be throws path-error.
//cell is 2nd-Column, 1st-Row. value is 789.123.
jxl.write.Number number = new jxl.write.Number(1, 0, 789.123);
//add defined cell above to sheet instance.
sheet.addCell(number);
//add defined all cell above to case.
book.write();
//close file case.
book.close();
} catch (Exception e) {
e.printStackTrace();
}
}
}
±àÒëÖ´Ðк󣬻áÔ
Ïà¹ØÎĵµ£º
¹¹½¨¸ßÐÔÄܵÄJ2EEÓ¦Óò»µ«ÐèÒªÁ˽ⳣÓõÄʵʩ¼¼ÇÉ¡£ÏÂÃæ½éÉÜ×î³£ÓõÄ10ÖÖÓÐЧ·½·¨£¬¿É°ïÖú¼Ü¹¹Éè¼ÆÊ¦ÃÇ¿ìËÙ³ÉΪÕâ·½ÃæµÄר¼Ò¡£
JavaÐÔÄܵĻù´¡—ÄÚ´æ¹ÜÀí
ÈκÎJavaÓ¦Ó㬵¥»úµÄ»òJ2EEµÄÐÔÄÜ»ù´¡¶¼¿É¹é½áµ½ÄãµÄÓ¦ÓÃÊÇÈçºÎ¹ÜÀíÄÚ´æµÄÎÊÌâ¡£JavaµÄÄÚ´æ¹ÜÀí°üÀ¨Á½¸öÖØÒªÈÎÎñ£ºÄÚ´æµÄ·ÖÅäºÍÄÚ´æµÄ»ØÊÕ¡£ÔÚÄÚ´æµÄ·ÖÅäÖУ¬Ä ......
package Demo;
// ͨÅä·û
class Info14<T> {
private T var; // ¶¨Òå·ºÐͱäÁ¿
public void setVar(T var) {
this.var = var;
}
public T getVar() {
return this.var;
}
public String toString() { // Ö±½Ó´òÓ¡
return this.var.toString();
}
}
public class GenericsDemo14 {
public ......
package Demo;
// Java·ºÐͽӿÚ
interface Info24<T> { // ÔÚ½Ó¿ÚÉ϶¨Òå·ºÐÍ
public T getVar(); // ¶¨Òå³éÏó·½·¨£¬³éÏó·½·¨µÄ·µ»ØÖµ¾ÍÊÇ·ºÐÍÀàÐÍ
}
class InfoImp24<T> implements Info24<T> { // ¶¨Òå·ºÐͽӿڵÄ×ÓÀà
private T var; // ¶¨ÒåÊôÐÔ
public InfoImp24(T var) { // ͨ¹ý¹¹Ôì·½·¨É ......
ÏÂÃæµÄÀý×Ó£¬¾ÍÊÇʹÓÃObjectSNMP»ñÈ¡RFC1213-MIBµÄÀý×Ó£ºÆäÖеÄsystemºÍifTable¶ÔÏó¾ÍÊǶÔÓ¦µÄSNMP MIBÖеÄsystem×éºÏinterfaceÖеÄifTable±í¡£
class TestMibMapping
{
SNMPAPI snmpapi;
SNMPNodeParam nodeParam;
public TestMibMapping()
{
try
{
/**
......
ÏÂÃæÊÇ20¸ö·Ç³£ÓÐÓõÄJava³ÌÐòƬ¶Î£¬Ï£ÍûÄܶÔÄãÓÐÓá£
1. ×Ö·û´®ÓÐÕûÐ͵ÄÏ໥ת»»
1
2
String a = String.valueOf(2); //integer to numeric string
3
int i = Integer.parseInt(a); //numeric string to an int
2. ÏòÎļþĩβÌí¼ÓÄÚÈÝ
01
......