|
@@ -204,6 +204,7 @@ namespace ReportService
|
|
|
var groupFieldList = new List<string>();
|
|
|
var minRowSpanDic = new Dictionary<int, int>();
|
|
|
var otherMergeRowIndexs = new List<int>();
|
|
|
+ bool isHiddenBorder = true;
|
|
|
//查询是否存在绑定值
|
|
|
var tupleResult = QueryIsExistBindValue(table, mergeRowIndexs, reportInfo);
|
|
|
var fixedGroupFields = new List<string>();
|
|
@@ -213,6 +214,7 @@ namespace ReportService
|
|
|
minRowSpanDic = tupleResult.Item2;
|
|
|
otherMergeRowIndexs = tupleResult.Item3;
|
|
|
fixedGroupFields = tupleResult.Item4;
|
|
|
+ isHiddenBorder = tupleResult.Item5;
|
|
|
}
|
|
|
var otherMergeCellDictionary = new Dictionary<CellPostion, ICell>();
|
|
|
var existCellDictionary = new Dictionary<CellPostion, ICell>();
|
|
@@ -235,7 +237,7 @@ namespace ReportService
|
|
|
int newCellCount = 0;
|
|
|
if (isExistGroupFold)
|
|
|
{
|
|
|
- var cellDictionary = ResetTableGroupRowDefinition(fixedGroupFields, groupFieldList, table, existCellDictionary, columnCount, cellRowInfos, waitCloneICell, isAllFill, isTopTable);
|
|
|
+ var cellDictionary = ResetTableGroupRowDefinition(fixedGroupFields, groupFieldList, table, existCellDictionary, columnCount, cellRowInfos, waitCloneICell, isAllFill, isTopTable, isHiddenBorder);
|
|
|
|
|
|
table.Cells = cellDictionary;
|
|
|
}
|
|
@@ -251,7 +253,7 @@ namespace ReportService
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- var cellDictionary = ResetTabelCell(isTopTable, existCellDictionary, waitCloneICell, minRowSpanDic, table.RowDefinitions.Count, columnCount, diffCellCount, newCellCount, otherMergeCellDictionary, isAllFill);
|
|
|
+ var cellDictionary = ResetTabelCell(isTopTable, existCellDictionary, waitCloneICell, minRowSpanDic, table.RowDefinitions.Count, columnCount, diffCellCount, newCellCount, otherMergeCellDictionary, isAllFill, isHiddenBorder);
|
|
|
table.Cells = cellDictionary;
|
|
|
}
|
|
|
}
|
|
@@ -297,14 +299,48 @@ namespace ReportService
|
|
|
/// <param name="mergeRowIndexs"></param>
|
|
|
/// <param name="reportInfo"></param>
|
|
|
/// <returns></returns>
|
|
|
- private static Tuple<List<string>, Dictionary<int, int>, List<int>, List<string>> QueryIsExistBindValue(RTTable table, List<int> mergeRowIndexs, ReportInfo reportInfo)
|
|
|
+ private static Tuple<List<string>, Dictionary<int, int>, List<int>, List<string>, bool> QueryIsExistBindValue(RTTable table, List<int> mergeRowIndexs, ReportInfo reportInfo)
|
|
|
{
|
|
|
var groupFieldList = new List<string>();
|
|
|
var minRowSpanDic = new Dictionary<int, int>();
|
|
|
var staticTextGroupFieldList = new List<string>();
|
|
|
var inputGroupFieldList = new List<string>();
|
|
|
+ var isHiddenBorder = true;
|
|
|
foreach (var cell in table.Cells)
|
|
|
{
|
|
|
+ var borders = cell.Value.Borders;
|
|
|
+ if (borders.Bottom.BorderStyle == RTBorderStyle.None)
|
|
|
+ {
|
|
|
+ isHiddenBorder = isHiddenBorder & true;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ isHiddenBorder = isHiddenBorder & false;
|
|
|
+ }
|
|
|
+ if (borders.Top.BorderStyle == RTBorderStyle.None)
|
|
|
+ {
|
|
|
+ isHiddenBorder = isHiddenBorder & true;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ isHiddenBorder = isHiddenBorder & false;
|
|
|
+ }
|
|
|
+ if (borders.Left.BorderStyle == RTBorderStyle.None)
|
|
|
+ {
|
|
|
+ isHiddenBorder = isHiddenBorder & true;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ isHiddenBorder = isHiddenBorder & false;
|
|
|
+ }
|
|
|
+ if (borders.Right.BorderStyle == RTBorderStyle.None)
|
|
|
+ {
|
|
|
+ isHiddenBorder = isHiddenBorder & true;
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ isHiddenBorder = isHiddenBorder & false;
|
|
|
+ }
|
|
|
if (!mergeRowIndexs.Contains(cell.Key.Row))
|
|
|
{
|
|
|
var tempGroupField = ((RTCell)cell.Value).GroupField;
|
|
@@ -360,7 +396,7 @@ namespace ReportService
|
|
|
}
|
|
|
}
|
|
|
groupFieldList = groupFieldList.Distinct().ToList();
|
|
|
- return Tuple.Create(groupFieldList, minRowSpanDic, mergeRowIndexs, staticTextGroupFieldList);
|
|
|
+ return Tuple.Create(groupFieldList, minRowSpanDic, mergeRowIndexs, staticTextGroupFieldList, isHiddenBorder);
|
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
@@ -492,7 +528,7 @@ namespace ReportService
|
|
|
/// <returns>重新绘制的单元格</returns>
|
|
|
private static Dictionary<CellPostion, ICell> ResetTabelCell(bool isTopTable, Dictionary<CellPostion, ICell> existCellDictionary,
|
|
|
ICell waitCloneICell, Dictionary<int, int> minRowSpanDic, int tableRowCount, int columnCount, int diffCellCount, int newCellCount, Dictionary<CellPostion, ICell> otherMergeCellDictionary,
|
|
|
- bool isAllFill)
|
|
|
+ bool isAllFill, bool isHiddenBorder)
|
|
|
{
|
|
|
int rowIndex = 0;
|
|
|
int colIndex = 0;
|
|
@@ -501,7 +537,7 @@ namespace ReportService
|
|
|
foreach (var key in existCellDictionary.Keys)
|
|
|
{
|
|
|
var cellInfo = existCellDictionary[key];
|
|
|
- ResetCellBorderStyle(cellInfo, colIndex, rowIndex, tableRowCount, columnCount, key.RowSpan, key.ColumnSpan, isAllFill, isTopTable, false);
|
|
|
+ ResetCellBorderStyle(cellInfo, colIndex, rowIndex, tableRowCount, columnCount, key.RowSpan, key.ColumnSpan, isAllFill, isTopTable, false, isHiddenBorder:isHiddenBorder);
|
|
|
if (key.ColumnSpan > 1)
|
|
|
{
|
|
|
if ((colIndex + key.ColumnSpan) > columnCount)
|
|
@@ -563,7 +599,7 @@ namespace ReportService
|
|
|
var cellInfo = (waitCloneICell.Clone() as RTCell);
|
|
|
cellInfo.Borders.Bottom.BorderStyle = RTBorderStyle.Solid;
|
|
|
cellInfo.Background = RTColor.White;
|
|
|
- ResetCellBorderStyle(cellInfo, colIndex, rowIndex, tableRowCount, columnCount, 1, 1, isAllFill, isTopTable);
|
|
|
+ ResetCellBorderStyle(cellInfo, colIndex, rowIndex, tableRowCount, columnCount, 1, 1, isAllFill, isTopTable, isHiddenBorder:isHiddenBorder);
|
|
|
cellDictionary.Add(new CellPostion(rowIndex, colIndex, 1, 1), cellInfo);
|
|
|
}
|
|
|
rowIndex++;
|
|
@@ -579,7 +615,7 @@ namespace ReportService
|
|
|
rowIndex += minRowSpanDic[item.Row];
|
|
|
}
|
|
|
var cellInfo = otherMergeCellDictionary[item];
|
|
|
- ResetCellBorderStyle(cellInfo, item.Column, rowIndex, tableRowCount, columnCount, item.RowSpan, item.ColumnSpan, isAllFill, isTopTable);
|
|
|
+ ResetCellBorderStyle(cellInfo, item.Column, rowIndex, tableRowCount, columnCount, item.RowSpan, item.ColumnSpan, isAllFill, isTopTable, isHiddenBorder:isHiddenBorder);
|
|
|
lastRowIndex = item.Row;
|
|
|
var newCellPostion = new CellPostion(rowIndex, item.Column, item.RowSpan, item.ColumnSpan);
|
|
|
cellDictionary.Add(newCellPostion, cellInfo);
|
|
@@ -598,7 +634,7 @@ namespace ReportService
|
|
|
/// <param name="mergeRowIndexCount"></param>
|
|
|
/// <returns>重绘后表格内单元格的差异值</returns>
|
|
|
private static Dictionary<CellPostion, ICell> ResetTableGroupRowDefinition(List<string> fixedGroupFields, List<string> groupFieldList, RTTable table, Dictionary<CellPostion, ICell> existCellDictionary, int columnCount,
|
|
|
- Dictionary<string, RTRowDefinition> cellRowInfos,ICell waitCloneICell, bool isAllFill, bool isTopTable)
|
|
|
+ Dictionary<string, RTRowDefinition> cellRowInfos,ICell waitCloneICell, bool isAllFill, bool isTopTable, bool isHiddenBorder)
|
|
|
{
|
|
|
var spanColumnCell = existCellDictionary.Where(c => c.Key.ColumnSpan >= 1 && c.Key.RowSpan == 1)?.ToList() ?? new List<KeyValuePair<CellPostion, ICell>>();
|
|
|
|
|
@@ -696,7 +732,7 @@ namespace ReportService
|
|
|
foreach (var item in fCells)
|
|
|
{
|
|
|
var cellInfo = item.Value;
|
|
|
- ResetCellBorderStyle(cellInfo, curColIndex, curRowIndex, tableRowCount, columnCount, item.Key.RowSpan, item.Key.ColumnSpan, isAllFill, isTopTable);
|
|
|
+ ResetCellBorderStyle(cellInfo, curColIndex, curRowIndex, tableRowCount, columnCount, item.Key.RowSpan, item.Key.ColumnSpan, isAllFill, isTopTable, isHiddenBorder:isHiddenBorder);
|
|
|
item.Key.Row = curRowIndex;
|
|
|
item.Key.Column = curColIndex;
|
|
|
cellDictionary.Add(item.Key, cellInfo);
|
|
@@ -743,7 +779,7 @@ namespace ReportService
|
|
|
var cellInfo = (waitCloneICell.Clone() as RTCell);
|
|
|
cellInfo.Borders.Bottom.BorderStyle = RTBorderStyle.Solid;
|
|
|
cellInfo.Background = RTColor.White;
|
|
|
- ResetCellBorderStyle(cellInfo, colIndex, rowIndex, tableRowCount, columnCount, 1, 1, isAllFill, isTopTable);
|
|
|
+ ResetCellBorderStyle(cellInfo, colIndex, rowIndex, tableRowCount, columnCount, 1, 1, isAllFill, isTopTable, isHiddenBorder:isHiddenBorder);
|
|
|
cellDictionary.Add(new CellPostion(rowIndex, colIndex, 1, 1), cellInfo);
|
|
|
if ((colIndex + 1) >= columnCount)
|
|
|
{
|
|
@@ -933,8 +969,16 @@ namespace ReportService
|
|
|
/// <param name="rowIndex"></param>
|
|
|
/// <param name="tableCount"></param>
|
|
|
private static void ResetCellBorderStyle(ICell cellInfo, int colIndex, int rowIndex, int tableRowCount, int tableColumnCount, int rowSpan, int columnSpan,
|
|
|
- bool isAllFill, bool isTopTable, bool isShowTopBorder = true)
|
|
|
+ bool isAllFill, bool isTopTable, bool isShowTopBorder = true, bool isHiddenBorder = true)
|
|
|
{
|
|
|
+ if (isHiddenBorder)
|
|
|
+ {
|
|
|
+ cellInfo.Borders.Left.BorderStyle = RTBorderStyle.None;
|
|
|
+ cellInfo.Borders.Right.BorderStyle = RTBorderStyle.None;
|
|
|
+ cellInfo.Borders.Top.BorderStyle = RTBorderStyle.None;
|
|
|
+ cellInfo.Borders.Bottom.BorderStyle = RTBorderStyle.None;
|
|
|
+ return;
|
|
|
+ }
|
|
|
if (cellInfo.Borders.Left.BorderStyle != RTBorderStyle.None || cellInfo.Borders.Right.BorderStyle != RTBorderStyle.None ||
|
|
|
cellInfo.Borders.Bottom.BorderStyle != RTBorderStyle.None || cellInfo.Borders.Top.BorderStyle != RTBorderStyle.None)
|
|
|
{
|