|
protected override void OnRenderRow(DrawingContext drawingContext, RowInfo rowInfoList)
{
var cellsInfo = rowInfoList.CellsInfo;
//when we draw the cell for PrintStackedHeader=True we can't able to print it by normal way because the Stacked Header size is varied from one to another.
if (rowInfoList.RowType == RowType.StackedHeaderRow && CanPrintStackedHeaders)
{
for (int i = 0; i < cellsInfo.Count; i++)
{
OnRenderCell(drawingContext, rowInfoList, cellsInfo[i]);
//Last Cell Right Border
if (cellsInfo[i].Equals(cellsInfo[cellsInfo.Count - 1]))
drawingContext.DrawLine(new Pen(Brushes.Black, 1), cellsInfo[i].CellRect.TopRight, cellsInfo[i].CellRect.BottomRight); //Last cell Right border
if (rowInfoList.NeedTopBorder)
//Top border of the page
drawingContext.DrawLine(new Pen(Brushes.Black, 1), cellsInfo[i].CellRect.TopLeft, cellsInfo[i].CellRect.TopRight);
if (rowInfoList.NeedBottomBorder)
if (rowInfoList.CellsInfo[0].CellRect.Height > 0)
//Row Bottom Border
drawingContext.DrawLine(new Pen(Brushes.Black, 1), cellsInfo[i].CellRect.BottomLeft, cellsInfo[i].CellRect.BottomRight);
}
}
else if (rowInfoList.RowType == RowType.HeaderRow)
{
for (int i = 0; i < cellsInfo.Count; i++)
{
OnRenderCell(drawingContext, rowInfoList, cellsInfo[i]);
//Last Cell Right Border
if (cellsInfo[i].Equals(cellsInfo[cellsInfo.Count - 1]))
drawingContext.DrawLine(new Pen(Brushes.Black, 1), cellsInfo[i].CellRect.TopRight, cellsInfo[i].CellRect.BottomRight); //Last cell Right border
if (cellsInfo[i].ColumnName == "CustomerName")
//Top border of the page
drawingContext.DrawLine(new Pen(Brushes.Black, 1), cellsInfo[i].CellRect.TopLeft, cellsInfo[i].CellRect.TopRight);
if (rowInfoList.NeedBottomBorder)
if (rowInfoList.CellsInfo[0].CellRect.Height > 0)
//Row Bottom Border
drawingContext.DrawLine(new Pen(Brushes.Black, 1), cellsInfo[i].CellRect.BottomLeft, cellsInfo[i].CellRect.BottomRight);
}
}
else
{
foreach (var cellInfo in cellsInfo)
{
OnRenderCell(drawingContext, rowInfoList, cellInfo);
//Last Cell Right Border
if (cellInfo.Equals(cellsInfo[cellsInfo.Count - 1]))
drawingContext.DrawLine(new Pen(Brushes.Black, 1), cellInfo.CellRect.TopRight, cellsInfo[cellsInfo.Count - 1].CellRect.BottomRight); //Last cell Right border
}
if (rowInfoList.NeedTopBorder)
//Top border of the page
drawingContext.DrawLine(new Pen(Brushes.Black, 1), cellsInfo[0].CellRect.TopLeft, cellsInfo[cellsInfo.Count - 1].CellRect.TopRight);
if (rowInfoList.NeedBottomBorder)
if (rowInfoList.CellsInfo[0].CellRect.Height > 0)
//Row Bottom Border
drawingContext.DrawLine(new Pen(Brushes.Black, 1), cellsInfo[0].CellRect.BottomLeft, cellsInfo[cellsInfo.Count - 1].CellRect.BottomRight);
}
}
} |