private void MakeDetailFourData(DataTable EnrollRecordTable, UDT.Hierarchy Hierarchy, List<XElement> xElements, string WorksheetName, Dictionary<ReportHelper.CellObject, ReportHelper.CellStyle> dicCellStyles)
        {
            if (Hierarchy.DisplayOrder != 4)
                return;

            foreach (XElement xElement in xElements)
            {
                DataRow pRow = EnrollRecordTable.NewRow();

                pRow["No"] = xElement.Attribute("No").Value + ".";
                pRow["Content"] = HttpUtility.HtmlDecode(xElement.Attribute("Content").Value);

                EnrollRecordTable.Rows.Add(pRow);

                CellObject co = new CellObject(EnrollRecordTable.Rows.Count - 1, 0, EnrollRecordTable.TableName, "DataSection", WorksheetName);
                CellStyle cs = new CellStyle();

                //  題號 Style:Times New Roman、12號字、垂直靠上,水平置中
                cs.SetRowHeight(16.5).SetFontName("Times New Roman").SetFontSize(12).SetFontVerticalAlignment(CellStyle.VerticalAlignment.Top).SetFontHorizontalAlignment(CellStyle.HorizontalAlignment.Center);
                dicCellStyles.Add(co, cs);

                co = new CellObject(EnrollRecordTable.Rows.Count - 1, 1, EnrollRecordTable.TableName, "DataSection", WorksheetName);
                cs = new CellStyle();

                //  題目 Style:粗體、底線、標楷體、12號字、垂直靠上,水平靠左
                cs.SetFontBold(true).SetFontUnderline(true).SetFontName("標楷體").SetFontSize(12).SetFontVerticalAlignment(CellStyle.VerticalAlignment.Top).SetFontHorizontalAlignment(CellStyle.HorizontalAlignment.Left);
                dicCellStyles.Add(co, cs);

                IEnumerable<XElement> xAnswers = xElement.Descendants("Answer");
                int k = 0;
                foreach (XElement xElement_Answer in xAnswers)
                {
                    if (string.IsNullOrWhiteSpace(xElement_Answer.Value))
                        continue;

                    DataRow Row = EnrollRecordTable.NewRow();
                    k++;
                    Row["No"] = xElement.Attribute("No").Value + "-" + k;
                    Row["Content"] = HttpUtility.HtmlDecode(xElement_Answer.Value);

                    EnrollRecordTable.Rows.Add(Row);

                    co = new CellObject(EnrollRecordTable.Rows.Count - 1, 0, EnrollRecordTable.TableName, "DataSection", WorksheetName);
                    cs = new CellStyle();

                    //  回答項次 Style:Times New Roman、11號字、垂直靠上,水平置中
                    cs.SetFontName("Times New Roman").SetFontSize(11).SetFontVerticalAlignment(CellStyle.VerticalAlignment.Top).SetFontHorizontalAlignment(CellStyle.HorizontalAlignment.Center);
                    dicCellStyles.Add(co, cs);

                    co = new CellObject(EnrollRecordTable.Rows.Count - 1, 1, EnrollRecordTable.TableName, "DataSection", WorksheetName);
                    cs = new CellStyle();

                    //  回答內容 Style:新細明體、12號字、垂直靠上,水平靠左、自動調整列高
                    cs.SetFontName("新細明體").SetFontSize(12).SetFontVerticalAlignment(CellStyle.VerticalAlignment.Top).SetFontHorizontalAlignment(CellStyle.HorizontalAlignment.Left).SetAutoFitRow(true).Merge(1, 8);
                    dicCellStyles.Add(co, cs);
                }

                //  空一行
                pRow = EnrollRecordTable.NewRow();
                EnrollRecordTable.Rows.Add(pRow);

                co = new CellObject(EnrollRecordTable.Rows.Count - 1, 0, EnrollRecordTable.TableName, "DataSection", WorksheetName);
                cs = new CellStyle();
                cs.SetRowHeight(16.5);
                dicCellStyles.Add(co, cs);
            }
        }
        private void MakeGroupData(DataTable EnrollRecordTable, UDT.Hierarchy Hierarchy, string WorksheetName, Dictionary<ReportHelper.CellObject, ReportHelper.CellStyle> dicCellStyles)
        {
            DataRow pRow = EnrollRecordTable.NewRow();

            pRow["No"] = NoToChineseNo(Hierarchy.DisplayOrder) + "、" + Hierarchy.Title;

            if (Hierarchy.DisplayOrder == 1)
            {
                pRow["Option1AnswerCount"] = "(1)";
                pRow["Option2AnswerCount"] = "(2)";
                pRow["Option3AnswerCount"] = "(3)";
                pRow["Option4AnswerCount"] = "(4)";
                pRow["Option5AnswerCount"] = "(5)";
                pRow["Option6AnswerCount"] = "(6)";
                //pRow["Score"] = "評鑑值";
            }

            EnrollRecordTable.Rows.Add(pRow);

            CellObject co = new CellObject(EnrollRecordTable.Rows.Count - 1, 0, EnrollRecordTable.TableName, "DataSection", WorksheetName);
            CellStyle cs = new CellStyle();

            //  題目群組首 Style:標楷體、粗、12號字、水平靠左、垂直靠上
            cs.SetRowHeight(21.75).SetFontName("標楷體").SetFontSize(12).SetFontBold(true).SetFontHorizontalAlignment(CellStyle.HorizontalAlignment.Left).SetFontVerticalAlignment(CellStyle.VerticalAlignment.Top);
            dicCellStyles.Add(co, cs);

            //  答案選項標題 Style:TimesNewRoman、10號字、水平置中、垂直靠下
            for (int i = 2; i <= 7; i++)
            {
                co = new CellObject(EnrollRecordTable.Rows.Count - 1, i, EnrollRecordTable.TableName, "DataSection", WorksheetName);
                cs = new CellStyle();
                cs.SetFontName("Times New Roman").SetFontSize(10).SetFontHorizontalAlignment(CellStyle.HorizontalAlignment.Center).SetFontVerticalAlignment(CellStyle.VerticalAlignment.Bottom);
                dicCellStyles.Add(co, cs);
            }
            ////  評鑑值標題
            //co = new CellObject(EnrollRecordTable.Rows.Count - 1, 8, EnrollRecordTable.TableName, "DataSection", WorksheetName);
            //cs = new CellStyle();
            //cs.SetFontName("標楷體").SetFontSize(12).SetFontBold(true).SetFontHorizontalAlignment(HorizontalAlignment.Center).SetFontVerticalAlignment(HorizontalAlignment.Right);
            //dicCellStyles.Add(co, cs);
        }
        private void MakeDetailThreeData(DataTable EnrollRecordTable, UDT.Hierarchy Hierarchy, List<XElement> xElements, string WorksheetName, Dictionary<ReportHelper.CellObject, ReportHelper.CellStyle> dicCellStyles)
        {
            if (Hierarchy.DisplayOrder != 3)
                return;

            foreach (XElement xElement in xElements)
            {
                DataRow pRow = EnrollRecordTable.NewRow();

                pRow["No"] = xElement.Attribute("No").Value + ".";
                pRow["Content"] = HttpUtility.HtmlDecode(xElement.Attribute("Content").Value);
                IEnumerable<XElement> Options = xElement.Descendants("Option");
                if (Options.Count() > 0) Options = Options.OrderBy(x => int.Parse(x.Attribute("No").Value));
                int j = 0;
                foreach (XElement xOption in Options)
                {
                    pRow["Option" + xOption.Attribute("No").Value + "AnswerCount"] = xOption.Attribute("AnswerCount").Value;
                }
                if (xElement.Attribute("Score") != null)
                    pRow["Score"] = xElement.Attribute("Score").Value;

                EnrollRecordTable.Rows.Add(pRow);

                CellObject co = new CellObject(EnrollRecordTable.Rows.Count - 1, 0, EnrollRecordTable.TableName, "DataSection", WorksheetName);
                CellStyle cs = new CellStyle();

                //  題號 Style:Times New Roman、12號字、垂直靠上,水平置中
                cs.SetRowHeight(18.75).SetFontName("Times New Roman").SetFontSize(12).SetFontVerticalAlignment(CellStyle.VerticalAlignment.Top).SetFontHorizontalAlignment(CellStyle.HorizontalAlignment.Center);
                dicCellStyles.Add(co, cs);

                co = new CellObject(EnrollRecordTable.Rows.Count - 1, 1, EnrollRecordTable.TableName, "DataSection", WorksheetName);
                cs = new CellStyle();

                //  題目 Style:新細明體、12號字、垂直靠上,水平靠左
                cs.SetFontName("新細明體").SetFontSize(12).SetFontHorizontalAlignment(CellStyle.HorizontalAlignment.Left).SetFontVerticalAlignment(CellStyle.VerticalAlignment.Top).SetAutoFitRow(true);
                dicCellStyles.Add(co, cs);

                j = 2;
                foreach (XElement xOption in Options)
                {
                    //  答題數 Style:新細明體、12號字、水平置中、垂直靠下
                    co = new CellObject(EnrollRecordTable.Rows.Count - 1, j, EnrollRecordTable.TableName, "DataSection", WorksheetName);
                    cs = new CellStyle();
                    cs.SetFontName("新細明體").SetFontSize(12).SetFontVerticalAlignment(CellStyle.VerticalAlignment.Bottom).SetFontHorizontalAlignment(CellStyle.HorizontalAlignment.Center);
                    dicCellStyles.Add(co, cs);
                    j++;
                }

                //  評鑑值 Style:新細明體、12號字、垂直靠下、水平置中
                co = new CellObject(EnrollRecordTable.Rows.Count - 1, 8, EnrollRecordTable.TableName, "DataSection", WorksheetName);
                cs = new CellStyle();
                cs.SetFontName("新細明體").SetFontSize(12).SetFontVerticalAlignment(CellStyle.VerticalAlignment.Bottom).SetFontHorizontalAlignment(CellStyle.HorizontalAlignment.Center);
                dicCellStyles.Add(co, cs);
            }

            //  空一行
            DataRow Row = EnrollRecordTable.NewRow();
            EnrollRecordTable.Rows.Add(Row);

            CellObject cc = new CellObject(EnrollRecordTable.Rows.Count - 1, 0, EnrollRecordTable.TableName, "DataSection", WorksheetName);
            CellStyle ss = new CellStyle();
            ss.SetRowHeight(11);
            dicCellStyles.Add(cc, ss);
        }
        private void MakeDetailTwoData(DataTable EnrollRecordTable, UDT.Hierarchy Hierarchy, List<XElement> xElements, IEnumerable<XElement> xStatisticsGroup, string WorksheetName, Dictionary<ReportHelper.CellObject, ReportHelper.CellStyle> dicCellStyles, Dictionary<string, Dictionary<string, Color>> dicQuestionBackgroundColor, Dictionary<string, Dictionary<string, Color>> dicEvaluationBackgroundColor, string SurveyID)
        {
            if (Hierarchy.DisplayOrder != 2)
                return;

            if (xElements.Count == 0) return;

            IEnumerable<XElement> Options = xElements.ElementAt(0).Descendants("Option");
            if (Options.Count() > 0) Options = Options.OrderBy(x => int.Parse(x.Attribute("No").Value));

            //  列舉答案選項
            DataRow pRow = EnrollRecordTable.NewRow();
            string option_content = string.Empty;
            int j = 0;
            foreach (XElement xOption in Options)
            {
                option_content += "(" + xOption.Attribute("No").Value + ")" + HttpUtility.HtmlDecode(xOption.Attribute("Content").Value) + "  ";
            }
            pRow["Content"] = option_content;
            pRow["Score"] = "評鑑值";
            EnrollRecordTable.Rows.Add(pRow);

            CellObject co = new CellObject(EnrollRecordTable.Rows.Count - 1, 1, EnrollRecordTable.TableName, "DataSection", WorksheetName);
            CellStyle cs = new CellStyle();

            //  答題選項 Style:粗體、標楷體、12號字、垂直靠下
            cs.SetRowHeight(18).SetFontBold(true).SetFontName("標楷體").SetFontSize(12).SetFontVerticalAlignment(CellStyle.VerticalAlignment.Bottom);
            dicCellStyles.Add(co, cs);

            co = new CellObject(EnrollRecordTable.Rows.Count - 1, 8, EnrollRecordTable.TableName, "DataSection", WorksheetName);
            cs = new CellStyle();

            //  評鑑值 Style:粗體、標楷體、12號字、水平置中、垂直靠下
            cs.SetFontName("標楷體").SetFontBold(true).SetFontSize(12).SetFontHorizontalAlignment(CellStyle.HorizontalAlignment.Center).SetFontVerticalAlignment(CellStyle.VerticalAlignment.Bottom);
            dicCellStyles.Add(co, cs);

            //  列舉答案題號
            pRow = EnrollRecordTable.NewRow();
            foreach (XElement xOption in Options)
            {
                pRow["Option" + xOption.Attribute("No").Value + "AnswerCount"] = "(" + xOption.Attribute("No").Value + ")";
            }
            EnrollRecordTable.Rows.Add(pRow);

            //  答案項次 Style:Times New Roman、10號字、水平置中、垂直靠下
            j = 2;
            foreach (XElement xOption in Options)
            {
                co = new CellObject(EnrollRecordTable.Rows.Count - 1, j, EnrollRecordTable.TableName, "DataSection", WorksheetName);
                cs = new CellStyle();

                cs.SetRowHeight(14.25).SetFontName("Times New Roman").SetFontSize(10).SetFontVerticalAlignment(CellStyle.VerticalAlignment.Bottom).SetFontHorizontalAlignment(CellStyle.HorizontalAlignment.Center);
                dicCellStyles.Add(co, cs);
                j++;
            }

            //  列舉學生做答
            foreach (XElement xElement in xElements)
            {
                if (xElement.Attribute("IsCase").Value == "是")
                    continue;

                pRow = EnrollRecordTable.NewRow();

                pRow["No"] = xElement.Attribute("No").Value + ".";
                pRow["Content"] = HttpUtility.HtmlDecode(xElement.Attribute("Content").Value);

                foreach (XElement xOption in xElement.Descendants("Option"))
                {
                    pRow["Option" + xOption.Attribute("No").Value + "AnswerCount"] = xOption.Attribute("AnswerCount").Value;
                }
                if (xElement.Attribute("Score") != null)
                    pRow["Score"] = xElement.Attribute("Score").Value;

                EnrollRecordTable.Rows.Add(pRow);

                //  題號 Style:Times New Roman、12號字、水平置中、垂直靠上
                co = new CellObject(EnrollRecordTable.Rows.Count - 1, 0, EnrollRecordTable.TableName, "DataSection", WorksheetName);
                cs = new CellStyle();
                cs.SetRowHeight(16.5).SetFontName("Times New Roman").SetFontSize(12).SetFontVerticalAlignment(CellStyle.VerticalAlignment.Top).SetFontHorizontalAlignment(CellStyle.HorizontalAlignment.Center);
                dicCellStyles.Add(co, cs);

                //  題目 Style:新細明體、12號字、水平靠左、垂直靠上
                co = new CellObject(EnrollRecordTable.Rows.Count - 1, 1, EnrollRecordTable.TableName, "DataSection", WorksheetName);
                cs = new CellStyle();
                cs.SetFontName("新細明體").SetFontSize(12).SetFontHorizontalAlignment(CellStyle.HorizontalAlignment.Left).SetFontVerticalAlignment(CellStyle.VerticalAlignment.Top).SetAutoFitRow(true);
                if (dicQuestionBackgroundColor.ContainsKey(SurveyID))
                    if (dicQuestionBackgroundColor[SurveyID].ContainsKey(xElement.Attribute("No").Value))
                        cs.SetFontBackGroundColor(dicQuestionBackgroundColor[SurveyID][xElement.Attribute("No").Value]);
                dicCellStyles.Add(co, cs);

                for (int zz = 2; zz <= 7; zz++)
                {
                    //  答題數 Style:新細明體、12號字、水平置中、垂直靠下
                    co = new CellObject(EnrollRecordTable.Rows.Count - 1, zz, EnrollRecordTable.TableName, "DataSection", WorksheetName);
                    cs = new CellStyle();
                    cs.SetFontName("新細明體").SetFontSize(12).SetFontVerticalAlignment(CellStyle.VerticalAlignment.Bottom).SetFontHorizontalAlignment(CellStyle.HorizontalAlignment.Center);
                    if (dicQuestionBackgroundColor.ContainsKey(SurveyID))
                        if (dicQuestionBackgroundColor[SurveyID].ContainsKey(xElement.Attribute("No").Value))
                            cs.SetFontBackGroundColor(dicQuestionBackgroundColor[SurveyID][xElement.Attribute("No").Value]);
                    dicCellStyles.Add(co, cs);
                }

                //  評鑑值 Style:新細明體、12號字、垂直靠下、水平置中
                co = new CellObject(EnrollRecordTable.Rows.Count - 1, 8, EnrollRecordTable.TableName, "DataSection", WorksheetName);
                cs = new CellStyle();
                cs.SetFontName("新細明體").SetFontSize(12).SetFontVerticalAlignment(CellStyle.VerticalAlignment.Bottom).SetFontHorizontalAlignment(CellStyle.HorizontalAlignment.Center);
                if (dicQuestionBackgroundColor.ContainsKey(SurveyID))
                    if (dicQuestionBackgroundColor[SurveyID].ContainsKey(xElement.Attribute("No").Value))
                        cs.SetFontBackGroundColor(dicQuestionBackgroundColor[SurveyID][xElement.Attribute("No").Value]);
                dicCellStyles.Add(co, cs);
            }
            //  平均評鑑值
            foreach (XElement xElement in xStatisticsGroup)
            {
                pRow = EnrollRecordTable.NewRow();

                //pRow["No"] = string.Empty;
                pRow["Content"] = HttpUtility.HtmlDecode(xElement.Attribute("Content").Value);
                pRow["Score"] = xElement.Attribute("Score").Value;

                EnrollRecordTable.Rows.Add(pRow);

                //  平均評鑑值標題 Style:粗體、底線、標楷體、12號字、水平靠左、垂直靠上
                co = new CellObject(EnrollRecordTable.Rows.Count - 1, 1, EnrollRecordTable.TableName, "DataSection", WorksheetName);
                cs = new CellStyle();
                cs.SetRowHeight(18).SetFontBold(true).SetFontUnderline(true).SetFontName("標楷體").SetFontSize(12).SetFontHorizontalAlignment(CellStyle.HorizontalAlignment.Left).SetFontVerticalAlignment(CellStyle.VerticalAlignment.Top);
                dicCellStyles.Add(co, cs);

                //  評鑑值 Style:新細明體、12號字、垂直靠下、水平置中
                co = new CellObject(EnrollRecordTable.Rows.Count - 1, 8, EnrollRecordTable.TableName, "DataSection", WorksheetName);
                cs = new CellStyle();
                cs.SetFontName("新細明體").SetFontSize(12).SetFontVerticalAlignment(CellStyle.VerticalAlignment.Bottom).SetFontHorizontalAlignment(CellStyle.HorizontalAlignment.Center);
                //  評鑑值背景色
                if (dicEvaluationBackgroundColor.ContainsKey(SurveyID))
                    if (dicEvaluationBackgroundColor[SurveyID].ContainsKey(HttpUtility.HtmlDecode(xElement.Attribute("Content").Value)))
                        cs.SetFontBackGroundColor(dicEvaluationBackgroundColor[SurveyID][HttpUtility.HtmlDecode(xElement.Attribute("Content").Value)]);
                dicCellStyles.Add(co, cs);
            }
            if (xElements.Where(x => x.Attribute("IsCase").Value == "是").Count() > 0)
            {
                //  空一行
                pRow = EnrollRecordTable.NewRow();
                EnrollRecordTable.Rows.Add(pRow);

                co = new CellObject(EnrollRecordTable.Rows.Count - 1, 0, EnrollRecordTable.TableName, "DataSection", WorksheetName);
                cs = new CellStyle();
                cs.SetRowHeight(9.5);
                dicCellStyles.Add(co, cs);
            }
            //  個案題
            foreach (XElement xElement in xElements)
            {
                if (xElement.Attribute("IsCase").Value == "否")
                    continue;

                pRow = EnrollRecordTable.NewRow();

                pRow["No"] = xElement.Attribute("No").Value + ".";
                pRow["Content"] = HttpUtility.HtmlDecode(xElement.Attribute("Content").Value);

                EnrollRecordTable.Rows.Add(pRow);

                //  題號 Style:Times New Roman、12號字、垂直靠上,水平置中
                co = new CellObject(EnrollRecordTable.Rows.Count - 1, 0, EnrollRecordTable.TableName, "DataSection", WorksheetName);
                cs = new CellStyle();
                cs.SetRowHeight(18).SetFontName("Times New Roman").SetFontSize(12).SetFontVerticalAlignment(CellStyle.VerticalAlignment.Top).SetFontHorizontalAlignment(CellStyle.HorizontalAlignment.Center);
                dicCellStyles.Add(co, cs);

                //  題目 Style:新細明體、12號字、垂直靠上,水平靠左
                co = new CellObject(EnrollRecordTable.Rows.Count - 1, 1, EnrollRecordTable.TableName, "DataSection", WorksheetName);
                cs = new CellStyle();
                cs.SetFontName("新細明體").SetFontSize(12).SetFontHorizontalAlignment(CellStyle.HorizontalAlignment.Left).SetFontVerticalAlignment(CellStyle.VerticalAlignment.Top).SetAutoFitRow(true);
                dicCellStyles.Add(co, cs);

                IEnumerable<XElement> xCases = xElement.Descendants("Case");
                int z = 0;
                foreach (XElement xCase in xCases)
                {
                    z++;

                    pRow = EnrollRecordTable.NewRow();

                    pRow["No"] = xElement.Attribute("No").Value + "-" + z;
                    pRow["Content"] = HttpUtility.HtmlDecode(xCase.Attribute("Content").Value);
                    pRow["Score"] = xCase.Attribute("Score").Value;

                    Options = xCase.Descendants("Option");
                    if (Options.Count() > 0) Options = Options.OrderBy(x => int.Parse(x.Attribute("No").Value));
                    foreach (XElement xOption in Options)
                    {
                        pRow["Option" + xOption.Attribute("No").Value + "AnswerCount"] = xOption.Attribute("AnswerCount").Value;
                    }
                    EnrollRecordTable.Rows.Add(pRow);

                    //  題號 Style:Times New Roman、11號字、垂直靠上,水平置中
                    co = new CellObject(EnrollRecordTable.Rows.Count - 1, 0, EnrollRecordTable.TableName, "DataSection", WorksheetName);
                    cs = new CellStyle();
                    cs.SetFontName("Times New Roman").SetFontSize(11).SetFontVerticalAlignment(CellStyle.VerticalAlignment.Top).SetFontHorizontalAlignment(CellStyle.HorizontalAlignment.Center);
                    dicCellStyles.Add(co, cs);

                    //  題目 Style:新細明體、12號字、垂直靠上,水平靠左
                    co = new CellObject(EnrollRecordTable.Rows.Count - 1, 1, EnrollRecordTable.TableName, "DataSection", WorksheetName);
                    cs = new CellStyle();
                    cs.SetFontName("新細明體").SetFontSize(12).SetFontHorizontalAlignment(CellStyle.HorizontalAlignment.Left).SetFontVerticalAlignment(CellStyle.VerticalAlignment.Top).SetAutoFitRow(true);
                    dicCellStyles.Add(co, cs);

                    j = 2;
                    foreach (XElement xOption in Options)
                    {
                        //  答題數 Style:新細明體、12號字、水平置中、垂直靠下
                        co = new CellObject(EnrollRecordTable.Rows.Count - 1, j, EnrollRecordTable.TableName, "DataSection", WorksheetName);
                        cs = new CellStyle();
                        cs.SetFontName("新細明體").SetFontSize(12).SetFontVerticalAlignment(CellStyle.VerticalAlignment.Bottom).SetFontHorizontalAlignment(CellStyle.HorizontalAlignment.Center);
                        dicCellStyles.Add(co, cs);
                        j++;
                    }

                    //  評鑑值 Style:新細明體、12號字、垂直靠下、水平置中
                    co = new CellObject(EnrollRecordTable.Rows.Count - 1, 8, EnrollRecordTable.TableName, "DataSection", WorksheetName);
                    cs = new CellStyle();
                    cs.SetFontName("新細明體").SetFontSize(12).SetFontVerticalAlignment(CellStyle.VerticalAlignment.Bottom).SetFontHorizontalAlignment(CellStyle.HorizontalAlignment.Center);
                    dicCellStyles.Add(co, cs);
                }
            }
            //  空一行
            pRow = EnrollRecordTable.NewRow();
            EnrollRecordTable.Rows.Add(pRow);

            if (xElements.Where(x => x.Attribute("IsCase").Value == "是").Count() > 0)
            {
                co = new CellObject(EnrollRecordTable.Rows.Count - 1, 0, EnrollRecordTable.TableName, "DataSection", WorksheetName);
                cs = new CellStyle();
                cs.SetRowHeight(11);
                dicCellStyles.Add(co, cs);
            }
            else
            {
                co = new CellObject(EnrollRecordTable.Rows.Count - 1, 0, EnrollRecordTable.TableName, "DataSection", WorksheetName);
                cs = new CellStyle();
                cs.SetRowHeight(17.5);
                dicCellStyles.Add(co, cs);
            }
        }
        private void MakeDetailOneData(DataTable EnrollRecordTable, UDT.Hierarchy Hierarchy, List<XElement> xElements, string WorksheetName, Dictionary<ReportHelper.CellObject, ReportHelper.CellStyle> dicCellStyles)
        {
            if (Hierarchy.DisplayOrder != 1)
                return;

            foreach (XElement xElement in xElements)
            {
                DataRow pRow = EnrollRecordTable.NewRow();

                pRow["No"] = xElement.Attribute("No").Value + ".";
                pRow["Content"] = HttpUtility.HtmlDecode(xElement.Attribute("Content").Value);
                IEnumerable<XElement> Options = xElement.Descendants("Option");
                if (Options.Count() > 0) Options = Options.OrderBy(x => int.Parse(x.Attribute("No").Value));
                int j = 0;
                string question_content = string.Empty;
                foreach (XElement xOption in Options)
                {
                    pRow["Option" + xOption.Attribute("No").Value + "AnswerCount"] = xOption.Attribute("AnswerCount").Value;
                    question_content += "(" + xOption.Attribute("No").Value + ")" + HttpUtility.HtmlDecode(xOption.Attribute("Content").Value);
                }
                //if (question_content.EndsWith("、"))
                //    question_content = question_content.Remove(question_content.Length - 1, 1);
                pRow["Content"] += question_content;
                //pRow["Score"] = xElement.Attribute("Score").Value;

                EnrollRecordTable.Rows.Add(pRow);

                CellObject co = new CellObject(EnrollRecordTable.Rows.Count - 1, 0, EnrollRecordTable.TableName, "DataSection", WorksheetName);
                CellStyle cs = new CellStyle();

                //  題號 Style:Times New Roman、12號字、水平置中、垂直靠上
                cs.SetRowHeight(35).SetFontName("Times New Roman").SetFontSize(12).SetFontHorizontalAlignment(CellStyle.HorizontalAlignment.Center).SetFontVerticalAlignment(CellStyle.VerticalAlignment.Top);
                dicCellStyles.Add(co, cs);

                //  題目及答案選項 Style:12號字、水平靠左、垂直靠上
                co = new CellObject(EnrollRecordTable.Rows.Count - 1, 1, EnrollRecordTable.TableName, "DataSection", WorksheetName);
                cs = new CellStyle();
                cs.SetFontName("新細明體").SetFontSize(12).SetFontHorizontalAlignment(CellStyle.HorizontalAlignment.Left).SetFontVerticalAlignment(CellStyle.VerticalAlignment.Top).SetAutoFitRow(true);
                dicCellStyles.Add(co, cs);

                //  答題數
                j = 2;
                foreach (XElement xOption in Options)
                {
                    co = new CellObject(EnrollRecordTable.Rows.Count - 1, j, EnrollRecordTable.TableName, "DataSection", WorksheetName);
                    cs = new CellStyle();
                    cs.SetFontName("新細明體").SetFontSize(12).SetFontVerticalAlignment(CellStyle.VerticalAlignment.Bottom).SetFontHorizontalAlignment(CellStyle.HorizontalAlignment.Center);
                    dicCellStyles.Add(co, cs);
                    j++;
                }
            }
        }