第一张图是运行界面,运行时前两行表头是没有边框,但打印时,表头出现了浅蓝色边框。不管表头如何设置,打印时都有边框,如图所示:
我想达到的效果是:打印时前两行表头无边框,第3行表头显示自定义边框,代码如下,请大神帮忙解决。
this.fpSpread1_Sheet1.ColumnCount = 3;
this.fpSpread1_Sheet1.ColumnHeaderRowCount = 3;
this.fpSpread1_Sheet1.RowCount = 100;
this.fpSpread1_Sheet1.GrayAreaBackColor = Color.White;
this.fpSpread1_Sheet1.ColumnHeader.Cells[0, 0].ColumnSpan = 3;
this.fpSpread1_Sheet1.ColumnHeader.Cells[0, 0].HorizontalAlignment = FarPoint.Win.Spread.CellHorizontalAlignment.Center;
this.fpSpread1_Sheet1.ColumnHeader.Cells[0, 0].Value = "测试报表";
this.fpSpread1_Sheet1.ColumnHeader.Cells[1, 0].ColumnSpan = 3;
this.fpSpread1_Sheet1.ColumnHeader.Cells[1, 0].Value = "时间:2015-1-1至201-12-31";
this.fpSpread1_Sheet1.ColumnHeader.Cells[2, 0].Value = "科室";
this.fpSpread1_Sheet1.ColumnHeader.Cells[2, 1].Value = "性别";
this.fpSpread1_Sheet1.ColumnHeader.Cells[2, 2].Value = "人数";
for (int i = 0; i < 3; i++)
{
for (int j = 0; j < 3; j++)
{
this.fpSpread1_Sheet1.ColumnHeader.Cells[i, j].BackColor = Color.White;
}
}
FarPoint.Win.ComplexBorderSide ws = new FarPoint.Win.ComplexBorderSide(FarPoint.Win.ComplexBorderSideStyle.ThinLine, Color.White);
FarPoint.Win.ComplexBorderSide bs = new FarPoint.Win.ComplexBorderSide(FarPoint.Win.ComplexBorderSideStyle.ThinLine, Color.Black);
fpSpread1_Sheet1.ColumnHeader.Cells[0, 0, 1, 2].Border = new FarPoint.Win.ComplexBorder(ws, ws, ws, ws);
fpSpread1_Sheet1.ColumnHeader.Cells[2, 0, 2, 1].Border = new FarPoint.Win.ComplexBorder(bs, bs, ws, ws);
fpSpread1_Sheet1.ColumnHeader.Cells[2, 2, 2, 2].Border = new FarPoint.Win.ComplexBorder(bs, bs, bs, ws);
fpSpread1_Sheet1.ColumnHeader.HorizontalGridLine = new FarPoint.Win.Spread.GridLine(FarPoint.Win.Spread.GridLineType.None);
fpSpread1_Sheet1.ColumnHeader.VerticalGridLine = new FarPoint.Win.Spread.GridLine(FarPoint.Win.Spread.GridLineType.None);
for (int i = 0; i < 100; i++)
{
this.fpSpread1_Sheet1.Cells[i, 0].Value = "aaaa";
this.fpSpread1_Sheet1.Cells[i, 1].Value = "男";
this.fpSpread1_Sheet1.Cells[i, 2].Value = "10";
}
fpSpread1_Sheet1.HorizontalGridLine = new FarPoint.Win.Spread.GridLine(FarPoint.Win.Spread.GridLineType.None);
fpSpread1_Sheet1.VerticalGridLine = new FarPoint.Win.Spread.GridLine(FarPoint.Win.Spread.GridLineType.None);
fpSpread1_Sheet1.Cells[0, 0, 99, 1].Border = new FarPoint.Win.ComplexBorder(bs, bs, null, null);
fpSpread1_Sheet1.Cells[0, 2, 99, 2].Border = new FarPoint.Win.ComplexBorder(bs, bs, bs, null);
fpSpread1_Sheet1.Cells[99, 0, 99, 1].Border = new FarPoint.Win.ComplexBorder(bs, bs, null, bs);
fpSpread1_Sheet1.Cells[99, 2, 99, 2].Border = new FarPoint.Win.ComplexBorder(bs, bs, bs, bs);
|
|