아이오맵 내보내기 양식 변경, cr 구매요청시 담당자 그룹 입력하도록 함 데이터베잇 option3 필드 사용

This commit is contained in:
chi
2021-12-13 10:16:52 +09:00
parent f8c03784e6
commit 19525c71b6
13 changed files with 880 additions and 691 deletions

View File

@@ -246,24 +246,143 @@ namespace FPJ0000
private void toolStripButton2_Click(object sender, EventArgs e)
{
var bs = new BindingSource(this.dsPRJ, "ProjectsIOMap");
bs.Sort = "Dir desc";
var fp = new FarPoint.Win.Spread.FpSpread();
var newsheet = new FarPoint.Win.Spread.SheetView();
newsheet.SheetName = "Sheet1";
newsheet.DataSource = bs;
fp.Sheets.Add(newsheet);
//var bs = new BindingSource(this.dsPRJ, "ProjectsIOMap");
//bs.Sort = "Dir desc";
//var fp = new FarPoint.Win.Spread.FpSpread();
//var newsheet = new FarPoint.Win.Spread.SheetView();
//newsheet.SheetName = "Sheet1";
//newsheet.DataSource = bs;
//fp.Sheets.Add(newsheet);
var sd = new SaveFileDialog();
sd.Filter = "Excel|*.xls";
sd.Filter = "Excel|*.xlsx";
sd.FileName = "iomap";
if (sd.ShowDialog() != DialogResult.OK) return;
var rlt = fp.SaveExcel(sd.FileName,
FarPoint.Excel.ExcelSaveFlags.SaveAsViewed
| FarPoint.Excel.ExcelSaveFlags.SaveAsFiltered
| FarPoint.Excel.ExcelSaveFlags.NoFormulas
| FarPoint.Excel.ExcelSaveFlags.SaveCustomColumnHeaders);
if (rlt == false)
FCOMMON.Util.MsgE("저장 실패");
//var rlt = fp.SaveExcel(sd.FileName,
// FarPoint.Excel.ExcelSaveFlags.SaveAsViewed
// | FarPoint.Excel.ExcelSaveFlags.SaveAsFiltered
// | FarPoint.Excel.ExcelSaveFlags.NoFormulas
// | FarPoint.Excel.ExcelSaveFlags.SaveCustomColumnHeaders);
//if (rlt == false)
// FCOMMON.Util.MsgE("저장 실패");
libxl.Book book;// = new libxl.BinBook();
book = new libxl.XmlBook();
book.setKey(FCOMMON.info.libxlCompany, FCOMMON.info.libxlKey);
var cfTitle = book.addFormat();
cfTitle.alignH = libxl.AlignH.ALIGNH_CENTER;
cfTitle.alignV = libxl.AlignV.ALIGNV_CENTER;
cfTitle.setBorder(libxl.BorderStyle.BORDERSTYLE_THICK);
var cfTitleIn = book.addFormat();
cfTitleIn.alignH = libxl.AlignH.ALIGNH_CENTER;
cfTitleIn.alignV = libxl.AlignV.ALIGNV_CENTER;
cfTitleIn.fillPattern = libxl.FillPattern.FILLPATTERN_SOLID;
cfTitleIn.patternForegroundColor = libxl.Color.COLOR_YELLOW;
var cfTitleOut = book.addFormat();
cfTitleOut.alignH = libxl.AlignH.ALIGNH_CENTER;
cfTitleOut.alignV = libxl.AlignV.ALIGNV_CENTER;
cfTitleOut.fillPattern = libxl.FillPattern.FILLPATTERN_SOLID;
cfTitleOut.patternForegroundColor = libxl.Color.COLOR_PINK;
var cfTitleEtc = book.addFormat();
cfTitleEtc.alignH = libxl.AlignH.ALIGNH_CENTER;
cfTitleEtc.alignV = libxl.AlignV.ALIGNV_CENTER;
cfTitleEtc.fillPattern = libxl.FillPattern.FILLPATTERN_SOLID;
cfTitleEtc.patternForegroundColor = libxl.Color.COLOR_TEAL_CL;
var sheet = book.addSheet("IOMap");
sheet.writeStr(0, 1, "INPUT", cfTitle);
sheet.setMerge(0, 0, 1, 3);
var cf = sheet.cellFormat(0, 1);
sheet.writeStr(1, 1, "Pin", cfTitleIn);
sheet.writeStr(1, 2, "Title", cfTitleIn);
sheet.writeStr(1, 3, "Remark", cfTitleIn);
sheet.writeStr(0, 5, "OUTPUT", cfTitle);
sheet.setMerge(0, 0, 5, 7);
sheet.writeStr(1, 5, "Pin", cfTitleOut);
sheet.writeStr(1, 6, "Title", cfTitleOut);
sheet.writeStr(1, 7, "Remark", cfTitleOut);
sheet.writeStr(0, 9, "ETC", cfTitle);
sheet.setMerge(0, 0, 9, 12);
sheet.writeStr(1, 9, "Dir", cfTitleEtc);
sheet.writeStr(1, 10, "Pin", cfTitleEtc);
sheet.writeStr(1, 11, "Title", cfTitleEtc);
sheet.writeStr(1, 12, "Remark", cfTitleEtc);
var row = 2;
for (int r = 0; r < fpIN.ActiveSheet.RowCount; r++)
{
var col = 1;
var pin = fpIN.ActiveSheet.Cells[r, 0].Value?.ToString() ?? string.Empty;
var title = fpIN.ActiveSheet.Cells[r, 1].Value?.ToString() ?? string.Empty;
var remark = fpIN.ActiveSheet.Cells[r, 2].Value?.ToString() ?? string.Empty;
sheet.writeStr(row, col++, pin);
sheet.writeStr(row, col++, title);
sheet.writeStr(row, col++, remark);
row += 1;
}
row = 2;
for (int r = 0; r < fpOut.ActiveSheet.RowCount; r++)
{
var col = 5;
var pin = fpOut.ActiveSheet.Cells[r, 0].Value?.ToString() ?? string.Empty;
var title = fpOut.ActiveSheet.Cells[r, 1].Value?.ToString() ?? string.Empty;
var remark = fpOut.ActiveSheet.Cells[r, 2].Value?.ToString() ?? string.Empty;
sheet.writeStr(row, col++, pin);
sheet.writeStr(row, col++, title);
sheet.writeStr(row, col++, remark);
row += 1;
}
row = 2;
for (int r = 0; r < fpEtc.ActiveSheet.RowCount; r++)
{
var col = 9;
var dir = fpEtc.ActiveSheet.Cells[r, 0].Value?.ToString() ?? string.Empty;
var pin = fpEtc.ActiveSheet.Cells[r, 1].Value?.ToString() ?? string.Empty;
var title = fpEtc.ActiveSheet.Cells[r, 2].Value?.ToString() ?? string.Empty;
var remark = fpEtc.ActiveSheet.Cells[r, 3].Value?.ToString() ?? string.Empty;
sheet.writeStr(row, col++, dir);
sheet.writeStr(row, col++, pin);
sheet.writeStr(row, col++, title);
sheet.writeStr(row, col++, remark);
row += 1;
}
book.save(sd.FileName);
util.RunExplorer(sd.FileName);
}
}
}