public void CreateReport(MainDocumentPart mainPart, Report report) { TextContent tc = new TextContent(); tc.GenerateTextContent(mainPart, report.Client, contentSourceXml); ChartItem chartItem = null; string controlName = null; // Model Table Table table = report.ModelTable(); controlName = "ModelTable"; AddTableToDoc(mainPart, table, controlName); // Drawdown chartItem = report.Drawdown(); controlName = chartItem.CustomControlName; AddChartToDoc(mainPart, chartItem, controlName); // Comparison Chart if (report.Client.ExistingAssets) { chartItem = report.AllocationComparison(); controlName = chartItem.CustomControlName; AddChartToDoc(mainPart, chartItem, controlName); } // Stress Test Market Rise Bar Chart chartItem = report.StressTestMarketRise(); controlName = chartItem.CustomControlName; AddChartToDoc(mainPart, chartItem, controlName); // Stress Test Market Crash Bar Chart chartItem = report.StressTestMarketCrash(); controlName = chartItem.CustomControlName; AddChartToDoc(mainPart, chartItem, controlName); // Allocation Pie Chart chartItem = report.Allocation(); controlName = chartItem.CustomControlName; AddChartToDoc(mainPart, chartItem, controlName); // Rolling Return 1 yr chartItem = report.RollingReturnChart(1); controlName = chartItem.CustomControlName; AddChartToDoc(mainPart, chartItem, controlName); // Rolling Return 3 yr chartItem = report.RollingReturnChart(3); controlName = chartItem.CustomControlName; AddChartToDoc(mainPart, chartItem, controlName); // Rolling Return 5 yr chartItem = report.RollingReturnChart(5); controlName = chartItem.CustomControlName; AddChartToDoc(mainPart, chartItem, controlName); // Ten Year Return Chart chartItem = report.TenYearReturn(); controlName = chartItem.CustomControlName; AddChartToDoc(mainPart, chartItem, controlName); // save and close document mainPart.Document.Save(); }
private void AddChartsToDoc(MainDocumentPart mainPart, Report report) { string controlName = null; ChartItem chartItem = null; // Allocation Pie Chart chartItem = report.Allocation(); AddChartToDoc(mainPart, chartItem); // Comparison Chart if (report.Client.ExistingAssets) { chartItem = report.AllocationComparison(); AddChartToDoc(mainPart, chartItem); } else { controlName = report.GetContentControlNameForChart("allocation-comparison"); RemoveContentControlFromBlock(mainPart, controlName); } // Drawdown chartItem = report.Drawdown(); AddChartToDoc(mainPart, chartItem); // Ten Year Return Chart chartItem = report.TenYearReturn(); AddChartToDoc(mainPart, chartItem); // Stress Test Market Rise Bar Chart chartItem = report.StressTestMarketRise(); AddChartToDoc(mainPart, chartItem); // Stress Test Market Crash Bar Chart chartItem = report.StressTestMarketCrash(); AddChartToDoc(mainPart, chartItem); // Rolling Return 1 yr chartItem = report.RollingReturnChart(1); AddChartToDoc(mainPart, chartItem); // Rolling Return 3 yr chartItem = report.RollingReturnChart(3); AddChartToDoc(mainPart, chartItem); // Rolling Return 5 yr chartItem = report.RollingReturnChart(5); AddChartToDoc(mainPart, chartItem); }