导出边框到Excel
问题描述:如何设置单元格的边框样式,使其可以导出到Excel。问题解答:Spread提供LineBorder等类用于设置边框。
关键代码:
private void ExportLineBorder()
{
fpSpread1.ActiveSheet.Cells.Value = "test";//客户名称
fpSpread1.BorderCollapse = FarPoint.Win.Spread.BorderCollapse.Collapse;//合并显示
fpSpread1.ActiveSheet.Cells.Border = new FarPoint.Win.LineBorder(Color.Black, 1, true, true, true, true);
fpSpread1.ActiveSheet.Cells.Border = new FarPoint.Win.LineBorder(Color.Black, 1, true, true, true, true);
this.fpSpread1.SaveExcel("test.xls");
}
效果截图:
示例下载:点击下载
页:
[1]