private void initialViewSetting(int idx) { readyDataGridView(dataGridViewL, dataGridViewR, dataGridViewT); if (loadExistingOsResultsData()) { if (idx < 0) { idx = 0; } if (idx > ord.Length) { idx = 0; } loadOsResultsContData(ord[idx]); loadOsResultsSumData(ord[idx]); reCalculateAll(dataGridViewL, dataGridViewR, dataGridViewT); viewOsResultsData(idx); edit_lblPageNo(); buttonGrpEnabled(); buttonNew.Enabled = false; } else { DMessage.DataNotExistence("空の状態で表示します。"); buttonGrpDisabled(); } }
private void initialProcessing(int idx) { readyDataGrieView(); if (loadExistingAccountData()) { viewData(idx); buttonGrpEnabled(); buttonNew.Enabled = false; } else { DMessage.DataNotExistence("空の状態で表示します。"); buttonGrpDisabled(); buttonNew.Enabled = true; } }
private void initialProcessing() { readyDataGridView(dataGridViewL, dataGridViewR, dataGridViewT); if (loadExistingOsResultsData()) { cpg = 0; loadOsResultsContData(ord[cpg]); loadOsResultsSumData(ord[cpg]); reCalculateAll(dataGridViewL, dataGridViewR, dataGridViewT); viewOsResultsData(0); edit_lblPageNo(); buttonGrpEnabled(); buttonNew.Enabled = false; } else { DMessage.DataNotExistence("空の状態で表示します。"); buttonGrpDisabled(); buttonNew.Enabled = true; } }
//---------------------------------------------------------/ // Method //---------------------------------------------------------/ public void ExcelFile() { string tempFile = Folder.DefaultLocation() + @"\.~temp.xlsx"; Cursor.Current = Cursors.WaitCursor; // マウスカーソルを砂時計(Wait) try { using (oWBook = new XLWorkbook(fileName)) { if (tncA == null || tncA.Length == 0) { DMessage.DataNotExistence("中断します!"); return; } // 編集 oWSheet = oWBook.Worksheet(1); // シートを開く readyExcelRows(tncA.Length, 4); int sNo = 5; for (int i = 0; i < tncA.Length; i++) { using (IXLRange SetRange = oWSheet.Range("A5:M5")) // テンプレートデータ行コピー/ペースト SetRange.CopyTo(oWSheet.Cell(sNo + i, 1)); if (i == 0) { officeName = tncA[i].OfficeName; oWSheet.Cell(2, 3).Value = DateTime.Today; oWSheet.Cell(3, 3).Value = officeName; } oWSheet.Cell(sNo + i, 1).Value = i + 1; oWSheet.Cell(sNo + i, 2).Value = tncA[i].TaskCode; oWSheet.Cell(sNo + i, 3).Value = tncA[i].TaskName; oWSheet.Cell(sNo + i, 4).Value = tncA[i].VersionNo; oWSheet.Cell(sNo + i, 5).Value = tncA[i].IssueDate; oWSheet.Cell(sNo + i, 6).Value = tncA[i].SalesMName; oWSheet.Cell(sNo + i, 7).Value = tncA[i].SalesMInputDate; oWSheet.Cell(sNo + i, 8).Value = tncA[i].Approval; oWSheet.Cell(sNo + i, 9).Value = tncA[i].ApprovalDate; oWSheet.Cell(sNo + i, 10).Value = tncA[i].MakeOrder; oWSheet.Cell(sNo + i, 11).Value = tncA[i].MakeOrderDate; oWSheet.Cell(sNo + i, 12).Value = tncA[i].ConfirmAdm; oWSheet.Cell(sNo + i, 13).Value = tncA[i].ConfirmDate; if (i != 0) { oWSheet.Range(sNo + i, 1, sNo + i, 13).Style.Border.TopBorder = XLBorderStyleValues.Hair; } if (i == tncA.Length - 1) { oWSheet.Range(sNo + i, 1, sNo + i, 13).Style.Border.BottomBorder = XLBorderStyleValues.Thin; } else { oWSheet.Range(sNo + i, 1, sNo + i, 13).Style.Border.BottomBorder = XLBorderStyleValues.Hair; } } } // 保存 oWBook.SaveAs(tempFile); // Excel保存 } catch (Exception ex) { MessageBox.Show(ex.Message); Cursor.Current = Cursors.Default; // マウスカーソルを戻す return; } Cursor.Current = Cursors.Default; // マウスカーソルを戻す System.Diagnostics.Process.Start("Excel.exe", tempFile); // 表示用Excel // pdf出力にする場合は、上記 System.DiafnosticsのLineをコメントアウトし、下記DateTime以下のコメントを外す。 // pdf file 出力 //DateTime now = DateTime.Now; //outputFile = System.IO.Path.GetDirectoryName( tempFile ) + @"\業務引継書承認未完了一覧表_" + officeName + "_" + "_" + now.ToString( "yyMMddHHmmss" ); //PublishExcelToPdf etp = new PublishExcelToPdf(); //etp.ExcelToPDF( tempFile, outputFile ); //if( File.Exists( tempFile ) ) File.Delete( tempFile ); }
//---------------------------------------------------------/ // Method //---------------------------------------------------------/ public void ExcelFile(string proc) { string tempFile = Folder.DefaultLocation() + @"\.~temp.xlsx"; Cursor.Current = Cursors.WaitCursor; // マウスカーソルを砂時計(Wait) // Wakamatsu 20170313 try { using (oWBook = new XLWorkbook(fileName)) { // 編集 switch (procList.IndexOf(proc)) { case 0: case 1: if (pod == null || pod.Length == 0) { DMessage.DataNotExistence("中断します!"); return; } //MessageBox.Show("Excel書込み開始"); if (proc == payoff) { oWSheet = oWBook.Worksheet(1); // シートを開く editOsPayOff(pod); // 起案書発行 } else { // Wakamatsu 20170313 //decimal sum = 0M; //int page = pod.Length / posRow; //if (pod.Length % posRow > 0) page++; //for (int i = 0; i < page; i++) //{ // oWSheet = oWBook.Worksheet(i + 1); // シートを開く // oWSheet.Cell(3, 5).Value = "'" + (i + 1).ToString() + "/" + page.ToString(); // sum = editOsPayOffS(pod, posRow * i, sum); // 起案書発行 //} oWSheet = oWBook.Worksheet(1); // シートを開く oWSheet.Cell(3, 5).Value = "'1/1"; editOsPayOffS(pod, posRow, 0); // 起案書発行 // Wakamatsu 20170313 } break; case 2: if (pmd == null || pmd.Length == 0) { DMessage.DataNotExistence("中断します!"); return; } //MessageBox.Show("Excel書込み開始"); oWSheet = oWBook.Worksheet(1); // シートを開く editOsPayment(pmd); // 調書発行 break; default: break; } // 保存 oWBook.SaveAs(tempFile); // Excel保存 } } catch (Exception ex) { MessageBox.Show(ex.Message); Cursor.Current = Cursors.Default; // マウスカーソルを戻す return; } // Wakamatsu 20170313 Cursor.Current = Cursors.Default; // マウスカーソルを戻す //System.Diagnostics.Process.Start("Excel.exe", tempFile); // 表示用Excel // pdf file 出力 DateTime now = DateTime.Now; outputFile = System.IO.Path.GetDirectoryName(tempFile) + @"\" + pNameList[procList.IndexOf(proc)] + "_" + itemCode + "_" + now.ToString("yyMMddHHmmss"); PublishExcelToPdf etp = new PublishExcelToPdf(); // Wakamatsu 20170313 //etp.ExcelToPDF(tempFile, outputFile); if (etp.ExcelToPDF(tempFile, outputFile) == true) { if (File.Exists(tempFile)) { File.Delete(tempFile); } } }
//---------------------------------------------------------/ // Method //---------------------------------------------------------/ public void ExcelFile() { string tempFile = Folder.DefaultLocation() + @"\.~temp.xlsx"; Cursor.Current = Cursors.WaitCursor; // マウスカーソルを砂時計(Wait) // Wakamatsu 20170315 try { using (oWBook = new XLWorkbook(fileName)) { if (tla == null || tla.Length == 0) { DMessage.DataNotExistence("中断します!"); return; } // 編集 oWSheet = oWBook.Worksheet(1); // シートを開く // Wakamatsu 20170315 //readyExcelRows(tla.Length, 5); readyExcelRows(tla.Length, 4); int sNo = 5; for (int i = 0; i < tla.Length; i++) { // Wakamatsu 20170315 using (IXLRange SetRange = oWSheet.Range("A5:I5")) // テンプレートデータ行コピー/ペースト SetRange.CopyTo(oWSheet.Cell(sNo + i, 1)); // Wakamatsu 20170315 if (i == 0) { officeName = tla[i].OfficeName; departName = tla[i].DepartName; // Wakamatsu 20170315 //oWSheet.Cell(1, 7).Value = DateTime.Today; oWSheet.Cell(2, 2).Value = DateTime.Today; oWSheet.Cell(3, 2).Value = officeName + " " + departName; // Wakamatsu 20170315 } oWSheet.Cell(sNo + i, 1).Value = tla[i].TaskCode; oWSheet.Cell(sNo + i, 2).Value = tla[i].TaskName; oWSheet.Cell(sNo + i, 3).Value = tla[i].PartnerName; oWSheet.Cell(sNo + i, 4).Value = tla[i].Contract; oWSheet.Cell(sNo + i, 5).Value = tla[i].StartDate; oWSheet.Cell(sNo + i, 6).Value = tla[i].EndDate; oWSheet.Cell(sNo + i, 7).Value = tla[i].SalesM; oWSheet.Cell(sNo + i, 8).Value = tla[i].LeaderM; oWSheet.Cell(sNo + i, 9).Value = tla[i].IssueDate; // Wakamatsu 20170315 if (i != 0) { oWSheet.Range(sNo + i, 1, sNo + i, 9).Style.Border.TopBorder = XLBorderStyleValues.Hair; } if (i == tla.Length - 1) { oWSheet.Range(sNo + i, 1, sNo + i, 9).Style.Border.BottomBorder = XLBorderStyleValues.Thin; } else { oWSheet.Range(sNo + i, 1, sNo + i, 9).Style.Border.BottomBorder = XLBorderStyleValues.Hair; } // Wakamatsu 20170315 } } // 保存 oWBook.SaveAs(tempFile); // Excel保存 } // Wakamatsu 20170315 catch (Exception ex) { MessageBox.Show(ex.Message); Cursor.Current = Cursors.Default; // マウスカーソルを戻す return; } // Wakamatsu 20170315 Cursor.Current = Cursors.Default; // マウスカーソルを戻す //System.Diagnostics.Process.Start("Excel.exe", tempFile); // 表示用Excel // pdf file 出力 DateTime now = DateTime.Now; outputFile = System.IO.Path.GetDirectoryName(tempFile) + @"\業務一覧表_" + officeName + "_" + departName + "_" + now.ToString("yyMMddHHmmss"); PublishExcelToPdf etp = new PublishExcelToPdf(); etp.ExcelToPDF(tempFile, outputFile); if (File.Exists(tempFile)) { File.Delete(tempFile); } }