这种效果用水晶报表很好实现(问题导出excel不能出现边框),想来想去通过gridview实现,然后导出excel估计图中效果会比较好。本人已经实现了前两列(invoice date,invoice no)相同的合并,现在就是要做根据invoice no 合并的统计金额(amount(USD)而且列也是合并的的) 【有没有哪位大侠帮帮俺实现这种效果,在此感激不禁】
合并前两项的代码:
//相同合并
public static void MergeRows(GridView gridView)
{
for (int rowIndex = gridView.Rows.Count - 2; rowIndex >= 0; rowIndex--)
{
GridViewRow row = gridView.Rows[rowIndex];
GridViewRow previousRow = gridView.Rows[rowIndex + 1];
for (int i = 0; i < 2; i++)
{
if (row.Cells.Text == previousRow.Cells.Text)
{
if (previousRow.Cells.RowSpan < 2)
{
row.Cells.RowSpan = 2;
}
else
{
row.Cells.RowSpan = previousRow.Cells.RowSpan + 1;
}
previousRow.Cells.Visible = false;
}
}
}
}