java认证辅导:jxl实用技巧(1)Java认证考试

文章作者 100test 发表时间 2010:01:01 15:52:18
来源 100Test.Com百考试题网


  import java.io.File.

  import java.io.FileOutputStream.

  import java.io.OutputStream.

  import java.util.ArrayList.

  import java.util.Date.

  import java.util.HashMap.

  import jxl.Cell.

  import jxl.CellType.

  import jxl.DateCell.

  import jxl.Range.

  import jxl.Sheet.

  import jxl.Workbook.

  import jxl.WorkbookSettings.

  import jxl.format.Alignment.

  import jxl.format.Border.

  import jxl.format.BorderLineStyle.

  import jxl.format.CellFormat.

  import jxl.format.Colour.

  import jxl.format.UnderlineStyle.

  import jxl.format.VerticalAlignment.

  import jxl.write.Formula.

  import jxl.write.Label.

  import jxl.write.Number.

  import jxl.write.NumberFormat.

  import jxl.write.WritableCell.

  import jxl.write.WritableCellFeatures.

  import jxl.write.WritableCellFormat.

  import jxl.write.WritableFont.

  import jxl.write.WritableSheet.

  import jxl.write.WritableWorkbook.

  import jxl.write.WriteException.

  import jxl.write.biff.RowsExceededException.

  public class WriteExcelTest {

  static HashMap map = new HashMap().

  public static void main(String[] args) {

  try {

  // copyDateFormat(new File("c:\\a.xls"), 0, "c:\\copy of a.xls").

  writeExcelUseFormat("c:\\format.xls","test").

  // buildNewFormTemplete(new File("c:/templete.xls"),new File(

  // "c:/buildNewFormTemplete.xls")).

  // modifyDirectly1(new File("c:/templete.xls")).

  // modifyDirectly2(new File("c:/templete.xls")).

  //copyDateAndFormat(new File("c:/a.xls"), 0, "c:/a2.xls").

  } catch (Exception e) {

  // TODO 自动生成 catch 块

  e.printStackTrace().

  }

  }

  public static void modifyDirectly2(File inputFile) throws Exception {

  Workbook w1 = Workbook.getWorkbook(inputFile).

  WritableWorkbook w2 = Workbook.createWorkbook(inputFile, w1).

  WritableSheet sheet = w2.getSheet(0).

  WritableCell cell = null.

  CellFormat cf = null.

  // 加粗

  cell = sheet.getWritableCell(0, 0).

  WritableFont bold = new WritableFont(WritableFont.ARIAL,

  WritableFont.DEFAULT_POINT_SIZE, WritableFont.BOLD).

  cf = new WritableCellFormat(bold).

  cell.setCellFormat(cf).

  编辑特别推荐:

  jxl实用技巧(1)

  jxl实用技巧(2)



相关文章


Java里面的java.net.url类Java认证考试
AJAX和XMLHTTP原理Java认证考试
Java多线程小结:最近Coding的一点心得Java认证考试
java认证辅导:jxl实用技巧(2)Java认证考试
java认证辅导:jxl实用技巧(1)Java认证考试
java中如何将OutputStream转换为InputStreamJava认证考试
Java程序连接各种数据库的方法Java认证考试
Iterator迭代得到list中的值Java认证考试
JAVA可变参数使用Java认证考试
澳大利亚华人论坛
考好网
日本华人论坛
华人移民留学论坛
英国华人论坛