使用excel文档,在将新行插入合并范围地址时遇到一些小问题。问题是,它插入两个没有新行的字符串,但是当我双击这个合并地址范围时,它会自动插入新行。
using (var excel = new ExcelPackage())
{
var workSheetAudit = excel.Workbook.Worksheets.Add(AuditReportSheet);
var description = workSheetAudit.Cells[ReportDescription]; //A2:G2
description.Value = $"Company: Client Name {Environment.NewLine}Generated Date: 08-Jul-20AZ";
//Styling
using (description)
{
description.Merge = true;
description.Style.Font.Size = 8;
description.Style.Border.Bottom.Style = ExcelBorderStyle.Thick;
description.Style.Fill.PatternType = ExcelFillStyle.Solid;
description.Style.Font.Bold = true;
description.Style.Fill.BackgroundColor.SetColor(Color.FromArgb(153, 51, 102));
description.Style.HorizontalAlignment = ExcelHorizontalAlignment.Left;
description.Style.VerticalAlignment = ExcelVerticalAlignment.Top;
description.Style.Font.Color.SetColor(Color.White);
}
var stream = new MemoryStream(excel.GetAsByteArray());
return stream;
}