private void Append(IStatResult result, bool drawChart, int colOffset, bool hasLegend, string xName, string yName) { if (result == null) { return; } bCol = initBCol; bRow = 1; int currentCol = -1; _winExcelControl.SetCellValue(bRow, bCol, bRow, bCol + result.Columns.Length - 1, 1, masExcelAlignType.Center, Text.Replace(".", ""), "@"); bRow++; _winExcelControl.SetCellValue(bRow, bCol, bRow, bCol + result.Columns.Length - 1, 1, masExcelAlignType.General, result.Title, null); if (result.Columns != null && result.Columns.Length > 0) { bRow++; foreach (string colname in result.Columns) { currentCol++; _winExcelControl.SetCellValue(bRow, bCol, 1, masExcelAlignType.General, colname, null); _winExcelControl.SetBackColor(bRow, bCol, bRow, bCol, 216, 216, 216); bCol++; } } // int statBRow = bRow + 1; if (result.Rows != null && result.Rows.Length > 0) { foreach (string[] row in result.Rows) { currentCol = -1; bCol = initBCol; bRow++; foreach (string colContext in row) { currentCol++; _winExcelControl.SetCellValue(bRow, bCol, 1, masExcelAlignType.General, SetRound(colContext), null); bCol++; } SupplySpace(result); } } if (drawChart) { _winExcelControl.DrawStat(statBRow - 1, initBCol + colOffset, bRow, initBCol + result.Columns.Length - 1, "图表", Text.Replace(".", ""), xName, yName, _masExcelDrawStatType, false, hasLegend); } bRow += 3; }
public void Append(bool singleFile, IStatResult result, bool isTotal, int statImage) { if (result == null) { return; } bCol = initBCol; currentBRow = bRow; currentBCol = bCol; currentCol = -1; winExcelControl1.SetCellValue(bRow, bCol, bRow, bCol + result.Columns.Length - 1 - _indexies.Count, 1, masExcelAlignType.Center, Text.Replace(".", ""), "@"); bRow++; winExcelControl1.SetCellValue(bRow, bCol, bRow, bCol + result.Columns.Length - 1 - _indexies.Count, 1, masExcelAlignType.General, result.Title, null); if (result.Columns != null && result.Columns.Length > 0) { bRow++; foreach (string colname in result.Columns) { currentCol++; if (_indexies.Contains(currentCol)) { continue; } winExcelControl1.SetCellValue(bRow, bCol, 1, masExcelAlignType.General, colname, null); winExcelControl1.SetBackColor(bRow, bCol, bRow, bCol, 216, 216, 216); bCol++; } } // int statBRow = bRow + 1; if (result.Rows != null && result.Rows.Length > 0) { foreach (string[] row in result.Rows) { currentCol = -1; bCol = initBCol; bRow++; foreach (string colContext in row) { currentCol++; if (_indexies.Contains(currentCol)) { continue; } winExcelControl1.SetCellValue(bRow, bCol, 1, masExcelAlignType.General, SetRound(colContext), null); bCol++; } SupplySpace(singleFile, result); } if (isTotal && result.Rows.Length != 1) { winExcelControl1.SetTotalCellValue(statBRow - 1, initBCol, bRow, initBCol + result.Columns.Length - 1 - _indexies.Count, bCol, 1, masExcelAlignType.General, null); } } if (statImage != 0) { winExcelControl1.DrawStat(statBRow - 1, initBCol, bRow, initBCol + result.Columns.Length - 1 - _indexies.Count, "图表", Text.Replace(".", ""), "", result.Columns[1].IndexOf("(") != -1 ? (result.Columns[1].Substring(result.Columns[1].IndexOf("(") + 1, result.Columns[1].IndexOf(")") - result.Columns[1].IndexOf("(") - 1)) : "", _masExcelDrawStatType, false, true); } bRow += 3; }