ตัวอย่างของบทความนี้บอกวิธีการดำเนินการ Java Excel แบ่งปันสำหรับทุกคนสำหรับการอ้างอิงของคุณ ข้อมูลเฉพาะมีดังนี้:
Worbookbook Workbook = Workbook.createWorkbook (ไฟล์ใหม่ ("D: //Output.xls"); WritableSheet Sheet = Workbook.Createsheet ("การบรรยายสรุปโครงการ", 0); ), 18, writablefont.bold); writablefont.no_bold); ); Font18subject.setverticalign L.Format.legnment.left); 0); Sheet.addcell (ฉลากใหม่ (0,1, "หมายเลขโครงการ, Font12Subject)); Sheet.Addcell (ฉลากใหม่ (1, 1, ProjreportParam.getProj_Code (), Font12SubjectNobold); , 1, "ผู้จัดการโครงการ", Font12Subject); . 2, projreportparam.getplan_cost (), font12subjectnobold); ; 5, 3); Sheet.addcell (ฉลากใหม่ (1,6, "ชื่องาน", Font12Subject); Sheet.Addcell, Font12Subject); (ฉลากใหม่ (5,6, "สถานะ", Font12Subject); int i = 7; // line สำหรับ (projreportparamminfo projectParamminfo: ProjectParam.getProjreportParamminfolist () {sheet.addcell pharse_name () ฉลาก (1, i, projreportparamminfo.gettttttttttttttttttttttttttttttttttttttttttttta_itemm () ); projreportparamminfo.gettask_plan_sd ()) + " /" + utils.formatdate (projreportparamminfo.gettask_plan_fd ()), font12subjectnobold); ask_actual_fd ()) Font12SubjectNobold); Sheet.addcell (ฉลากใหม่ (0, J, "项目组成员及干系人", Font18Subject)); "หมายเลขซีเรียล", Font12Subject); Sheet.Addcell (ฉลากใหม่ (1, J+1, "ชื่อ", Font12Subject); Sheet.Addcell (ฉลากใหม่ (2, J+1, "ตัวละคร" ", Font12Subject)); sheet.addcell (ฉลากใหม่ (3, j+1, "ป้อนเวลาทีมงานโครงการ", font12subject); sheet.addcell (ฉลากใหม่ (4, j+1, "ออกจากทีมงานของทีมงาน", Font12Subject); Sheet addcell (ฉลากใหม่ (5, j+1, "ชั่วโมงทำงานสะสม", font12subject); int m = 1; // หมายเลขซีเรียล int n = j+2; tparamhrinfo: projreportparam .getprojreportparamhrinfolist () {sheet.addcell ฉลาก (0, n, m+"", font12subjectnobold); font12subjectnobold); sheet.addcell (ฉลากใหม่ (3, n, utils.formatdate (projreportparamhrinfo .. gethr_start_date ()), font12subjectnobold); sheet.addcell (ฉลากใหม่ (ฉลากใหม่ 4, n, utils.formatdate (projreportparamhrinfo.gethr_release_date ()), font12subjectnobold); } // สมาชิกในทีมโครงการและเนื้อหาการทำงานของบุคคลสิ้นสุด // เนื้อหาการทำงานของปัญหานี้ int k = n+1; ("startdate+" ถึง "+enddate+"), font18subject); .AddCell (ฉลากใหม่ (1, K+1 1, K+1 1, "ชื่องาน", FONT12SUBJECT); Sheet.AddCell (ฉลากใหม่ (2, K+1, "เวลาเริ่มต้นแผน", Font12Subject); Sheet AddCell (ฉลากใหม่ (3, K+1, "เวลาเริ่มต้นและเวลาสิ้นสุดจริง", Font12Subject); sheet.addcell (ฉลากใหม่ (4, K+1, "เวลาการวางแผน", Font12Subject); sheet.addcell (ใหม่ ฉลาก (5, K + 1, "ชั่วโมงทำงานจริง", Font12Subject); : tthisprojreportparamtaskinfolist ()) {sheet.addcell (ฉลากใหม่ (0, p, projreportparamtaskinfo.gettask_code (), font12subjectnobold); SubstNobold); ฉลาก (2, p, utils.formatdate (projreportparamtaskinfo.gettask_plan_sd ()) + " /" + utils.formatdate (projreportparamtaskinfo.gettask_plan_fd (), font12subjectnobold); (projreportparamtaskinfo.getttask_actual_sd ()) + " /" + utils.formatdate (projreportparamtaskinfo.gettask_actual_fd (), font12subjectnobold); 5, P, P , P, P, P, P, P, P, P, P, P, P, P, P, P, P, P, P, P, P, P, P, P, P, P, P, P, P, P, P, , P, P, P, P, P, P, P, P, P, P, P, P, P, P, P, P, P, P, P ที่ projreportparamtaskinfo.gettask_actual_manhour () font12subjectnobold); addcell me (), font12subjectnobold)); "เนื้อหาการทำงานในสัปดาห์หน้า font18subject); sheet.mergecells (0, q, 5, q); sheet.addcell (ฉลากใหม่ (0 (0 (0 (0 (0 (0 (0 (0 (0 (0 (0, q+1," หมายเลขงาน ", font12subject); sheet.addcell (ฉลากใหม่ (1, q+1," ชื่องาน ", font12subject); sheet.addcell (ฉลากใหม่ (2, q+1," "เวลาเริ่มต้นแผน", font12subject) ; Sheet.addcell (ฉลากใหม่ (3, Q+1, "เวลาสิ้นสุดแผน", Font12Subject); Sheet.Adddell (ฉลากใหม่ (4, Q+1, "ชั่วโมงการทำงานของแผน", Font12Subject); ฉลาก (5, Q + 1, "บุคลากรผู้บริหาร", Font12Subject); (), Font12SubjectNobold); Sheet.AddedCell (ฉลากใหม่ (1, R, Projreparamtask_item (), Font12SubjectNobold); sheet.addcell (2, 2, r, utils. sheet.addcell (ฉลากใหม่ (3, r, utils.formatdate (projreportparamtaskinfo.gettask_plan_fd ()), font12subjectnobold); ฉลากใหม่ (5, r, projreportparamtplan_emp_name), font12subjectnobold); AddCell (ฉลากใหม่ (0, S, "" ปัญหาที่มีอยู่และการแก้ปัญหาที่มีอยู่ ", font18subject); sheet.mergecells (0, s, 8, s); sheet.adddell (ฉลากใหม่ (0, s+1, วันที่รับรู้ , Font12Subject); Sheet.addcell (ฉลากใหม่ (1, S +1, "คำอธิบายปัญหา", Font12Subject); Sheet.adddell (ฉลากใหม่ (2, S, S +1, "ความเสี่ยงของมัน", Font12Subject); .AddCell (ฉลากใหม่ (3, S+1, "โซลูชัน", font12Subject); sheet.addcell (ฉลากใหม่ (4, s+1, "แก้ปัญหามนุษย์", font12subject)); sheet.addcell (ฉลากใหม่ (5 ฉลาก (5 , s+1, "เวลาเริ่มต้นแผน, font12subject); sheet.addcell (ฉลากใหม่ (6, s+1," เวลาเสร็จสิ้นแผน ", font12subject)) ;; ฉลากใหม่ (ฉลากใหม่ (7, s+1," สถานะปัญหา, Font12Subject); Sheet.Adddell (ฉลากใหม่ (8, S+ 1, "Summary", Font12Subject); int t = S+ 2; //: projreportparamriskinfo projreportparamriskinfo , t, utils.f ormatdate (projreportparamriskinfo.getsts_date ()), font12subjectnobold); 2, T, Projreportparamrisriskinfo.getproj_risk _item () font12subjectnobold); kinfo.getissue_resolve_emp () , font12subjectnobold); sheet.addcel l (ฉลากใหม่ (5, t, utils.formatdate (projreportparamriskinfo.getissue_plan_date ()), font12subjectnobold); ), Font12SubjectNobold); } // ปัญหาของโครงการ End Workbook.write ();หวังว่าบทความนี้จะเป็นประโยชน์กับการออกแบบโปรแกรม Java ของทุกคน