public static void WriteSecurityOptionSector(Worksheet worksheet, SecurityOptionSector securityOptionSector, string pageName, int curRow, int curCol, DateTime lastBusinessDay) { ExcelUtil.GetRange(curRow, curCol, curRow + 25, curCol + 7, worksheet).NumberFormat = "@"; worksheet.Cells[curRow, curCol] = pageName; ExcelUtil.GetRange(curRow, curCol, worksheet).Interior.Color = ColorTranslator.ToOle(Color.LightSkyBlue); ExcelUtil.GetRange(curRow, curCol, worksheet).Font.Bold = true; worksheet.Cells[curRow + 1, curCol + 1] = securityOptionSector.TradeDate.ToString("MMMyy"); worksheet.Cells[curRow + 1, curCol + 2] = lastBusinessDay.ToString("ddMMMyy").ToUpper(); if (!string.IsNullOrEmpty(securityOptionSector.TradedCompany.CompanyInfo.EnglishName)) { worksheet.Cells[curRow + 2, curCol + 1] = securityOptionSector.TradedCompany.CompanyInfo.EnglishName.ToUpper(); } if (!string.IsNullOrEmpty(securityOptionSector.TradedCompany.CompanyInfo.Ric)) { worksheet.Cells[curRow + 2, curCol + 2] = securityOptionSector.TradedCompany.CompanyInfo.Ric; } worksheet.Cells[curRow + 2, curCol + 3] = securityOptionSector.TradedCompany.CompanyInfo.OriginalName; worksheet.Cells[curRow + 2, curCol + 4] = securityOptionSector.Type; worksheet.Cells[curRow + 2, curCol + 5] = securityOptionSector.TradedCompany.TransSum; worksheet.Cells[curRow + 3, curCol + 1] = "SELL"; ExcelUtil.GetRange(curRow + 3, curCol + 1, curRow + 3, curCol + 3, worksheet).MergeCells = true; ExcelUtil.GetRange(curRow + 3, curCol + 1, curRow + 3, curCol + 3, worksheet).HorizontalAlignment = XlHAlign.xlHAlignCenter; worksheet.Cells[curRow + 3, curCol + 5] = "BUY"; ExcelUtil.GetRange(curRow + 3, curCol + 4, curRow + 3, curCol + 6, worksheet).MergeCells = true; ExcelUtil.GetRange(curRow + 3, curCol + 4, curRow + 3, curCol + 6, worksheet).HorizontalAlignment = XlHAlign.xlHAlignCenter; ExcelUtil.GetRange(curRow + 3, curCol + 1, curRow + 3, curCol + 6, worksheet).Font.Size = 13; ExcelUtil.GetRange(curRow + 3, curCol + 1, curRow + 3, curCol + 6, worksheet).Font.Bold = true; worksheet.Cells[curRow + 4, curCol + 1] = "JAPANESE"; worksheet.Cells[curRow + 4, curCol + 2] = "ENGLISH"; worksheet.Cells[curRow + 4, curCol + 3] = "OP/INT"; worksheet.Cells[curRow + 4, curCol + 4] = "JAPANESE"; worksheet.Cells[curRow + 4, curCol + 5] = "ENGLISH"; worksheet.Cells[curRow + 4, curCol + 6] = "OP/INT"; ExcelUtil.GetRange(curRow + 4, curCol + 1, curRow + 4, curCol + 6, worksheet).Font.Size = 13; ExcelUtil.GetRange(curRow + 4, curCol + 1, curRow + 4, curCol + 6, worksheet).Font.Bold = true; ExcelUtil.GetRange(curRow + 4, curCol + 1, curRow + 4, curCol + 6, worksheet).Font.Size = 13; ExcelUtil.GetRange(curRow + 4, curCol + 1, curRow + 4, curCol + 6, worksheet).Interior.Color = ColorTranslator.ToOle(Color.LightGray); WriteTransCompanyInfosForSecurityOption(worksheet, curRow + 5, curCol + 1, securityOptionSector); }
/// <summary> /// Write a sector for Security Option transaction /// </summary> /// <param name="worksheet"></param> /// <param name="startRow"></param> /// <param name="oseTransSector"></param> public static void WriteTransCompanyInfosForSecurityOption(Worksheet worksheet, int startRow, int curCol, SecurityOptionSector securityOptionTransSector) { int currentRow = startRow; if (securityOptionTransSector.SellCompanyInfoList.Count == 0) { worksheet.Cells[currentRow, curCol + 1] = "UNQ"; worksheet.Cells[currentRow, curCol] = "出来ず"; } if (securityOptionTransSector.BuyCompanyInfoList.Count == 0) { worksheet.Cells[currentRow, curCol + 4] = "UNQ"; worksheet.Cells[currentRow, curCol + 3] = "出来ず"; } using (ExcelLineWriter writer = new ExcelLineWriter(worksheet, currentRow, curCol, ExcelLineWriter.Direction.Right)) { for (int i = 0; i < securityOptionTransSector.SellCompanyInfoList.Count; i++) { OSETransSingleCompanyInfo singleCompanyInfo = securityOptionTransSector.SellCompanyInfoList[i]; writeCompanyInfoForSecurityOption(worksheet, writer, currentRow, singleCompanyInfo); writer.PlaceNext(startRow + i + 1, curCol); } writer.PlaceNext(startRow, curCol + 3); for (int i = 0; i < securityOptionTransSector.BuyCompanyInfoList.Count; i++) { OSETransSingleCompanyInfo singleCompanyInfo = securityOptionTransSector.BuyCompanyInfoList[i]; writeCompanyInfoForSecurityOption(worksheet, writer, startRow, singleCompanyInfo); writer.PlaceNext(startRow + i + 1, curCol + 3); } } }