/// <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); } } }
public static void writeCompanyInfoForSecurityOption(Worksheet worksheet, ExcelLineWriter writer, int startRow, OSETransSingleCompanyInfo singleCompanyInfo) { if (singleCompanyInfo != null && singleCompanyInfo.CompanyInfo != null) { if (!string.IsNullOrEmpty(singleCompanyInfo.CompanyInfo.JapaneseName)) { writer.WriteLine(singleCompanyInfo.CompanyInfo.JapaneseName); ExcelUtil.GetRange(writer.Row, writer.Col - 1, worksheet).HorizontalAlignment = XlHAlign.xlHAlignLeft; } else { writer.WriteLine(singleCompanyInfo.CompanyInfo.OriginalName); ExcelUtil.GetRange(writer.Row, writer.Col - 1, writer.Row, writer.Col, worksheet).Font.Color = ColorTranslator.ToOle(Color.Red); ExcelUtil.GetRange(writer.Row, writer.Col - 1, worksheet).HorizontalAlignment = XlHAlign.xlHAlignLeft; } if (!string.IsNullOrEmpty(singleCompanyInfo.CompanyInfo.EnglishName)) { writer.WriteLine(singleCompanyInfo.CompanyInfo.EnglishName); ExcelUtil.GetRange(writer.Row, writer.Col - 1, worksheet).HorizontalAlignment = XlHAlign.xlHAlignLeft; } else { writer.WriteLine(singleCompanyInfo.CompanyInfo.OriginalName); ExcelUtil.GetRange(writer.Row, writer.Col - 1, writer.Row, writer.Col, worksheet).Font.Color = ColorTranslator.ToOle(Color.Red); ExcelUtil.GetRange(writer.Row, writer.Col - 1, worksheet).HorizontalAlignment = XlHAlign.xlHAlignLeft; } writer.WriteLine(singleCompanyInfo.Volume_OP_INT.Replace(",", "")); ExcelUtil.GetRange(writer.Row, writer.Col - 1, worksheet).HorizontalAlignment = XlHAlign.xlHAlignRight; writer.PlaceNext(writer.Row + 1, writer.Col); } }