[英]Spreadsheetlight: Border around cell range, no internal borders
使用 SpreadsheetLight 我想在单元格范围周围添加一个边框(仅)。 该范围内不应有任何边界。
我想要的是:
我得到什么:
我使用的代码:
var testDoc = new SLDocument();
var testStyle = testDoc.CreateStyle();
testStyle.Border.Outline = true;
testStyle.Border.SetLeftBorder(DocumentFormat.OpenXml.Spreadsheet.BorderStyleValues.Thin, Color.Black);
testStyle.Border.SetRightBorder(DocumentFormat.OpenXml.Spreadsheet.BorderStyleValues.Thin, Color.Black);
testStyle.Border.SetTopBorder(DocumentFormat.OpenXml.Spreadsheet.BorderStyleValues.Thin, Color.Black);
testStyle.Border.SetBottomBorder(DocumentFormat.OpenXml.Spreadsheet.BorderStyleValues.Thin, Color.Black);
testDoc.SetCellStyle("A3", "F5", testStyle);
return testDoc;
我究竟做错了什么? 我希望选项 Border.Outline = true 只产生一个轮廓。 将其设置为 false 不会更改 output 中的任何内容。 我在 3.5.0 版(NuGet 上的最新版本)中使用 SpreadsheetLight。
我无法解决 styles 的问题,但我找到了另一种绘制边框的选项,这个选项实际上绘制了我想要的轮廓。 也许这可以帮助其他有同样问题的人:
testDoc.DrawBorder("A3", "F5", DocumentFormat.OpenXml.Spreadsheet.BorderStyleValues.Thin, Color.Black);
Estableces tus estilos:
style.Border.LeftBorder.BorderStyle = BorderStyleValues.Thin;
style.Border.LeftBorder.Color = System.Drawing.Color.Black;
style.Border.RightBorder.BorderStyle = BorderStyleValues.Thin;
style.Border.RightBorder.Color = System.Drawing.Color.Black;
style.Border.BottomBorder.BorderStyle = BorderStyleValues.Thin;
style.Border.BottomBorder.Color = System.Drawing.Color.Black;
style.Border.TopBorder.BorderStyle = BorderStyleValues.Thin;
style.Border.TopBorder.Color = System.Drawing.Color.Black;
定义 elrango de celdas a aplicarle el estilo definido que incluyen los margenes
slExcel.MergeWorksheetCells("B6","P6", style);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.