L'exemple de cet article indique la méthode d'opération Java Excel. Partagez-le pour tout le monde pour votre référence. Les détails sont les suivants:
WorksworkBook Workbook = Workbook.Createworkbook (nouveau fichier ("d: //output.xls"); writshesheet sheet = workbook.CreateSheet ("Project Briefing", 0); iTableFont Sonti18Font = new WriteableFont (WitheableFont.Createfont ("Song Style" ), 18, WriteableFont.Bold); WritableFont Sonti12Font = New WitcheableFont (WriteableFont.Createfont (Song Style "), 12, New WitheableFont (WriteableFont.Creatfont (" Song Style "), 12 WriteableFont.No_Bold); 8Subject.SetVerticArgnment (jxl.format.verticalignment.centre) ; L.format.Alignment.left); 0); , 1, "Project Manager", Font12Subject); )); 2, projReportParam.getPlan_Cost (), Font12SubjectNobold)); )); 5, 3). ; (Nouvelle étiquette (5,6, "Status", FONT12SUBject); int i = 7; // line for (projreportParamminfo projectParamminfo: projreportparam.getprojreportparamminfolist ()) {sheet.addcell pharse_name (), Font12SubjectNobold); Label (1, i, projReportParamminfo.gettttttttttttttttttttta_itemm (), Font12SubjectNobold); sheet.addcell (nouvelle étiquette 3, i, utils.formatDate ( ProjreportParamminfo.gettask_plan_sd ()) + "/" + utils.formatdate (projreportparamminfo.getTask_plan_fd ()), Font12SubjectNobold); _fd ()), FONT12SUBjectNobold); sheet.addcell (nouveau label (0, j, "项目组成员及干系人", Font18Subject)); "Numéro de série", FONT12SUBject); sheet.addcell (nouveau label (3, j + 1, "Entrez le temps de l'équipe de projet", FONT12SUBJET); sheet.addcell (nouveau label (4, j + 1, "Leave the Project Team Time", Font12Subject); feuille. Addcell (nouveau label (5, j + 1, "heures de travail cumulatives", Font12Subject); int m = 1; // numéro de série int n = j + 2; // tparamhrinfo: projReportParam .getProjreportParamHrinfolist ()) {sheet.addcell (New Label (0, N, M + "", FONT12SUBjectNobold); sheet.addcell (nouveau label (1, n, projreportParamhrinfo .getemp_name (), Font12SubjectNobold); sheet.addcell (new Label (2, n, projreportPaMhRinfo.getRole_name ( ), Font12SubjectNobold); Nouvelle étiquette (nouvelle étiquette 4, n, utils.formatDate (projreportparamhrinfo.gethr_release_date ()), Font12SubjectNobold); +;} // Les membres de l'équipe de projet et le contenu de travail de la personne finale // le contenu de travail de ce numéro int k = n + 1; Ce problème ("+ startDate +" to "+ endDate +"), Font18Subject); ; Sheet.AddCell (Nouvelle étiquette (1, K + 1 1, K + 1 1, "Nom de la tâche", FONT12SUBject); Sheet.AddCell (Nouvelle Label (2, K + 1, "Plan De départ", Font12Subject); sheet.addcell (nouveau label (3, K + 1, "Heure de début réelle et heure de fin", Font12Subject); sheet.addcell (new Label (4, K + 1, "Planning Time", Font12Subject); sheet.addcell (Nouvelle étiquette (5, K + 1, "heures de travail réelles", Font12Subject); sheet.addcell (nouvelle étiquette (6, K + 1, "Persons", Font12Subject); int p = k + 2; // avant ( ProjReportParamTaskInfo projReportParamTaskInfo: tThisprojReportParamTaskInfolist ()) {sheet.addcell (new Label (0, P, ProjReportParamTaskInfo.GetTTTask_Code (), Font12SubjectNobold); tttttttTask_Item (), Fon t12SubjectNobold); (New Label (2, P, utils.formatDate (projReportParamTaskInfo.getTask_Plan_Sd ()) + "/" + utils.formatDate (projReportParamTaskInfo.getTask_Plan_fd ()), Font12SubjectNobold); .FormatDate (projreportparamtaskinfo.getttask_actual_sd ()) + "/" + utils.formatdate (projreportparamtaskinfo.getTask_Actual_fd ()), FONT12SUBJECTNOBOLD); ubjectnobold); .Addcell (New Label (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 ProjReportParamTaskInfo.getTask_Actual_ManHour (), Font12SubjectNobold); sheet.addcell (new label (0, q, "work content next week, font18subject); sheet.mergecells (0, q, 5, q); sheet.addcell (new label (0 (0 (0 (0 (0 ( 0 (0 (0, Q + 1, "Numéro de tâche", FONT12SUBject); sheet.addcell (new Label (1, Q + 1, "Nom de la tâche", FONT12SUBJET); Sheet.AddCell (Nouvelle Label (2, Q + 1, "" Plan Start Time ", Font12Subject); sheet.addcell (new Label (3, Q + 1," Plan End Time ", Font12Subject); sheet.adddell (nouveau label (4, q + 1," Plan Working heures ", Font12Subject); sheet.addcell (nouveau label (5, q + 1," personnel exécutif ", Font12Subject); int r = q + 2; for (projreportParamTaskInfo projReportParamTaskInfo: proj reportparam.getnextprojrepparamtaskinfolist ()) {sheet.AddCell (Nouveau (0, R, projReportParamTaskInfo.getttask_code (), Font12SubjectNobold); Sheet.AddedCell (New Label (1, R, ProJReportParamTask_Item (), Font12SubjectNobold); Sheet.AddCell (New Label (2, R, Utils. projreportparamtaskinfo.getTask_plan_sd ()), Font12SubjectNobold)); . getTask_plan_manhour (), Font12SubjectNobold); S = R + 1; Label (0, S + 1, "Date de reconnaissance, Font12Subject); sheet.addcell (nouveau label (1, S + 1," Description du problème ", Font12Subject); sheet.adddell (nouvelle étiquette (2, S, S +1 , "Risque d'appartenance", FONT12-Subject); )); (New Label (7, S + 1, "Problème State, Font12Subject); sheet.adddell (nouveau label (8, S + 1," Résumé ", Font12Subject); int t = s + 2; //: projreportParamRiskInfo ProJreportParamRiskInfo: ProjReportParamRiskInfo .getProjReportParamRiskInfolist ()) {sheet.addcell (0, t, utils.f ormatdate (projreportParamRiskinfo.getststs_date (), Font12SubjectNobold); , Font12SubjectNobold); (Nouveau Label (4, t, projreportParamRiskinfo.getSiTSue_Resolve_emp (), Font12SubjectNobold); T, utils.formatDate (projReportParamRiskinfo.gettissue_date ()), Font12SubjectNobold); getissue_summarize (), font12SubjectNobold);On espère que cet article est utile à la conception du programme Java de tous.