private List<NormalAnswerVotedEntity> CreateAnswersVotedShapes(ResultSlideConfiguration resultConfig, Questions.Data.QuestionSlideConfiguration qConfig) { var lst = new List<NormalAnswerVotedEntity>(); float initialTop = 110; foreach (var answer in qConfig.Answers) { var ansVoted = new NormalAnswerVotedEntity(); int answerWidth = Convert.ToInt32(-100 + (100 - resultConfig.HistWidthPercent) * PowerPointHelper.SlideWidth / 100); int answerTextboxIndex; var answerTextbox = PowerPointHelper.CreateTextboxOn(resultConfig.SlideAssociated, 50, initialTop, answerWidth, 35, answer.TextToShow, 24, Microsoft.Office.Interop.PowerPoint.PpParagraphAlignment.ppAlignLeft, out answerTextboxIndex); int leftChart = PowerPointHelper.GetLeftByPercent(resultConfig.HistWidthPercent)-70; int widthChartValue = 0; if (!double.IsNaN(answer.GetPercentValue((int)resultConfig.Decimals))) widthChartValue = Convert.ToInt32(answer.GetPercentValue((int)resultConfig.Decimals)); int widthChart = PowerPointHelper.GetWidthByPercent(resultConfig.HistWidthPercent, widthChartValue); int shapeChartIndex; var shapeChart = PowerPointHelper.CreateShapeOn(resultConfig.SlideAssociated, leftChart, initialTop, widthChart, 35, out shapeChartIndex); int leftChartValue = (leftChart + widthChart + 2); int widtChartValue = 95; int shapeChartValueIndex; var shapeChartValue = PowerPointHelper.CreateTextboxOn(resultConfig.SlideAssociated, leftChartValue, initialTop, widtChartValue, 35, answer.GetValue(resultConfig.Valuetype, (int)resultConfig.Decimals), answer.GetValueFontSize(), Microsoft.Office.Interop.PowerPoint.PpParagraphAlignment.ppAlignLeft, out shapeChartValueIndex); ansVoted.AnswerTextBox = answerTextbox; ansVoted.AnswerTextBoxIndex = answerTextboxIndex; ansVoted.AnswerChart = shapeChart; ansVoted.AnswerChartIndex = shapeChartIndex; ansVoted.AnswerChartValue = shapeChartValue; ansVoted.AnswerChartValueIndex = shapeChartValueIndex; ansVoted.AnswerAssociated = answer; lst.Add(ansVoted); initialTop += 50; } if (resultConfig.ValueOrder == HistValueOrder.Ninguno) if(resultConfig.NormalConfig.CopyQuestionShpapesFormat) foreach (var answ in lst) { CopyQuestionShapesFormat(answ); } return lst; }
private void CopyQuestionShapesFormat(NormalAnswerVotedEntity answ) { answ.AnswerTextBox.Left = answ.AnswerAssociated.AnswerTextBox.Left; answ.AnswerTextBox.Top = answ.AnswerAssociated.AnswerTextBox.Top; answ.AnswerChart.Left = answ.AnswerTextBox.Left + answ.AnswerTextBox.Width - 70; answ.AnswerChart.Top = answ.AnswerTextBox.Top; answ.AnswerChartValue.Left = answ.AnswerChart.Left + answ.AnswerChart.Width; answ.AnswerChartValue.Top = answ.AnswerTextBox.Top; }