in BismNormalizer/BismNormalizer/TabularCompare/Core/Comparison.cs [363:511]
private void PopulateExcelRow(Excel.Worksheet Ws, ref int row, ref int lastDataSourceRow, ref int lastTableRow, ComparisonObject comparisonObject, ToolStripProgressBar progBar)
{
progBar.PerformStep();
row += 1;
// Close out groups if necessary
if (comparisonObject.ComparisonObjectType == ComparisonObjectType.DataSource || comparisonObject.ComparisonObjectType == ComparisonObjectType.Table || comparisonObject.ComparisonObjectType == ComparisonObjectType.Perspective || comparisonObject.ComparisonObjectType == ComparisonObjectType.Culture || comparisonObject.ComparisonObjectType == ComparisonObjectType.Role || comparisonObject.ComparisonObjectType == ComparisonObjectType.Expression || comparisonObject.ComparisonObjectType == ComparisonObjectType.Action) //treat perspectives/cultures/roles/expressions like datasources for purpose of grouping
{
// do we need to close a table group?
if (lastTableRow + 1 < row && lastTableRow != -1)
{
Ws.Application.Rows[Convert.ToString(lastTableRow + 1) + ":" + Convert.ToString(row - 1)].Select();
Ws.Application.Selection.Rows.Group();
}
lastTableRow = row;
}
//Type column
switch (comparisonObject.ComparisonObjectType)
{
case ComparisonObjectType.Model:
Ws.Cells[row, 1].Value = "Model";
break;
case ComparisonObjectType.DataSource:
Ws.Cells[row, 1].Value = "Data Source";
break;
case ComparisonObjectType.Table:
Ws.Cells[row, 1].Value = "Table";
break;
case ComparisonObjectType.Relationship:
Ws.Cells[row, 1].Value = "Relationship";
Ws.Cells[row, 1].InsertIndent(3);
Ws.Cells[row, 2].InsertIndent(3);
Ws.Cells[row, 5].InsertIndent(3);
break;
case ComparisonObjectType.Measure:
Ws.Cells[row, 1].Value = "Measure";
Ws.Cells[row, 1].InsertIndent(3);
Ws.Cells[row, 2].InsertIndent(3);
Ws.Cells[row, 5].InsertIndent(3);
break;
case ComparisonObjectType.Kpi:
Ws.Cells[row, 1].Value = "KPI";
Ws.Cells[row, 1].InsertIndent(3);
Ws.Cells[row, 2].InsertIndent(3);
Ws.Cells[row, 5].InsertIndent(3);
break;
case ComparisonObjectType.CalculationItem:
Ws.Cells[row, 1].Value = "Calculation Item";
Ws.Cells[row, 1].InsertIndent(3);
Ws.Cells[row, 2].InsertIndent(3);
Ws.Cells[row, 5].InsertIndent(3);
break;
case ComparisonObjectType.Perspective:
Ws.Cells[row, 1].Value = "Perspective";
break;
case ComparisonObjectType.Culture:
Ws.Cells[row, 1].Value = "Culture";
break;
case ComparisonObjectType.Role:
Ws.Cells[row, 1].Value = "Role";
break;
case ComparisonObjectType.Expression:
Ws.Cells[row, 1].Value = "Expression";
break;
case ComparisonObjectType.Action:
Ws.Cells[row, 1].Value = "Action";
break;
default:
Ws.Cells[row, 1].Value = comparisonObject.ComparisonObjectType.ToString();
break;
}
//Source Obj Name column
if (comparisonObject.SourceObjectName != null && comparisonObject.SourceObjectName != "")
{
Ws.Cells[row, 2].Value = comparisonObject.SourceObjectName;
if (comparisonObject.SourceObjectDefinition != null && comparisonObject.SourceObjectDefinition != "")
{
Ws.Cells[row, 3].Value = comparisonObject.SourceObjectDefinition;
}
}
else
{
Ws.Cells[row, 2].Interior.Pattern = Excel.Constants.xlSolid;
Ws.Cells[row, 2].Interior.PatternColorIndex = Excel.Constants.xlAutomatic;
Ws.Cells[row, 2].Interior.ThemeColor = Excel.XlThemeColor.xlThemeColorDark1;
Ws.Cells[row, 2].Interior.TintAndShade = -0.149998474074526;
Ws.Cells[row, 2].Interior.PatternTintAndShade = 0;
Ws.Cells[row, 3].Interior.Pattern = Excel.Constants.xlSolid;
Ws.Cells[row, 3].Interior.PatternColorIndex = Excel.Constants.xlAutomatic;
Ws.Cells[row, 3].Interior.ThemeColor = Excel.XlThemeColor.xlThemeColorDark1;
Ws.Cells[row, 3].Interior.TintAndShade = -0.149998474074526;
Ws.Cells[row, 3].Interior.PatternTintAndShade = 0;
}
//status
switch (comparisonObject.Status)
{
case ComparisonObjectStatus.SameDefinition:
Ws.Cells[row, 4].Value = "Same Definition";
break;
case ComparisonObjectStatus.DifferentDefinitions:
Ws.Cells[row, 4].Value = "Different Definitions";
break;
case ComparisonObjectStatus.MissingInTarget:
Ws.Cells[row, 4].Value = "Missing in Target";
break;
case ComparisonObjectStatus.MissingInSource:
Ws.Cells[row, 4].Value = "Missing in Source";
break;
default:
Ws.Cells[row, 4].Value = comparisonObject.Status.ToString();
break;
}
//Target Obj Name column
if (comparisonObject.TargetObjectName != null && comparisonObject.TargetObjectName != "")
{
Ws.Cells[row, 5].Value = comparisonObject.TargetObjectName;
if (comparisonObject.TargetObjectDefinition != null && comparisonObject.TargetObjectDefinition != "")
{
Ws.Cells[row, 6].Value = comparisonObject.TargetObjectDefinition;
}
}
else
{
Ws.Cells[row, 5].Interior.Pattern = Excel.Constants.xlSolid;
Ws.Cells[row, 5].Interior.PatternColorIndex = Excel.Constants.xlAutomatic;
Ws.Cells[row, 5].Interior.ThemeColor = Excel.XlThemeColor.xlThemeColorDark1;
Ws.Cells[row, 5].Interior.TintAndShade = -0.149998474074526;
Ws.Cells[row, 5].Interior.PatternTintAndShade = 0;
Ws.Cells[row, 6].Interior.Pattern = Excel.Constants.xlSolid;
Ws.Cells[row, 6].Interior.PatternColorIndex = Excel.Constants.xlAutomatic;
Ws.Cells[row, 6].Interior.ThemeColor = Excel.XlThemeColor.xlThemeColorDark1;
Ws.Cells[row, 6].Interior.TintAndShade = -0.149998474074526;
Ws.Cells[row, 6].Interior.PatternTintAndShade = 0;
}
// Insert blank in last cell so defintion doesn't overlap
Ws.Cells[row, 7].Value = " ";
foreach (ComparisonObject childComparisonObject in comparisonObject.ChildComparisonObjects)
{
PopulateExcelRow(Ws, ref row, ref lastDataSourceRow, ref lastTableRow, childComparisonObject, progBar);
}
}