//  選擇題-題目
        private DataBindedSheet GetQuestion(XElement xElement, UDT.Hierarchy Hierarchy, Workbook wb)
        {
            DataBindedSheet DataBindedSheet = new DataBindedSheet();

            DataBindedSheet.Worksheet = wb.Worksheets[Hierarchy.Title + "-選擇題-題目"];
            DataBindedSheet.DataTables = new List<DataTable>();
            //  項次
            DataBindedSheet.DataTables.Add((xElement.Attribute("No").Value + ".").ToDataTable("項次", "項次"));
            //  題目
            DataBindedSheet.DataTables.Add(HttpUtility.HtmlDecode(xElement.Attribute("Content").Value).ToDataTable("題目", "題目"));
            //  題目高度
            CellObject co = new CellObject(0, 0, "題目", DataBindedSheet.Key, this.WorksheetName);
            CellStyle cs = new CellStyle();
            cs.SetAutoFitRow(true).Merge(1, 1);
            //  題目背景色
            if (this._DicQuestionBackgroundColor.ContainsKey(SurveyID))
            {
                if (this._DicQuestionBackgroundColor[SurveyID].ContainsKey(xElement.Attribute("No").Value))
                {
                    cs.SetFontBackGroundColor(this._DicQuestionBackgroundColor[SurveyID][xElement.Attribute("No").Value]);
                    this.dicCellStyles.Add(co, cs);
                    goto Outline;
                }
            }
            this.dicCellStyles.Add(co, cs);
            Outline:

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

            string question_content = string.Empty;
            int i = 0;
            foreach (XElement xOption in Options)
            {
                i = i + 1;
                //  選項做答人數
                DataBindedSheet.DataTables.Add(xOption.Attribute("AnswerCount").Value.ToDataTable("做答人數-" + xOption.Attribute("No").Value, "做答人數-" + xOption.Attribute("No").Value));
                question_content += "(" + xOption.Attribute("No").Value + ")" + HttpUtility.HtmlDecode(xOption.Attribute("Content").Value);

                //  做答背景色
                co = new CellObject(0, 0, "做答人數-" + xOption.Attribute("No").Value, DataBindedSheet.Key, this.WorksheetName);
                cs = new CellStyle();
                if (this._DicQuestionBackgroundColor.ContainsKey(SurveyID))
                {
                    if (this._DicQuestionBackgroundColor[SurveyID].ContainsKey(xElement.Attribute("No").Value))
                    {
                        cs.SetFontBackGroundColor(this._DicQuestionBackgroundColor[SurveyID][xElement.Attribute("No").Value]);
                        this.dicCellStyles.Add(co, cs);
                    }
                }
            }
            for (int j = i; j < 6; j++)
            {
                //  補選項6背景色
                DataBindedSheet.DataTables.Add("".ToDataTable("做答人數-" + (j + 1), "做答人數-" + (j + 1)));
                co = new CellObject(0, 0, "做答人數-" + (j+1), DataBindedSheet.Key, this.WorksheetName);
                cs = new CellStyle();
                if (this._DicQuestionBackgroundColor.ContainsKey(SurveyID))
                {
                    if (this._DicQuestionBackgroundColor[SurveyID].ContainsKey(xElement.Attribute("No").Value))
                    {
                        cs.SetFontBackGroundColor(this._DicQuestionBackgroundColor[SurveyID][xElement.Attribute("No").Value]);
                        this.dicCellStyles.Add(co, cs);
                    }
                }

            }
            //  題目+選項
            DataBindedSheet.DataTables.Add(HttpUtility.HtmlDecode(xElement.Attribute("Content").Value + question_content).ToDataTable("題目+選項", "題目+選項"));
            //  評鑑值
            DataBindedSheet.DataTables.Add(xElement.Attribute("Score").Value.ToDataTable("評鑑值", "評鑑值"));
            //  評鑑值背景色
            co = new CellObject(0, 0, "評鑑值", DataBindedSheet.Key, this.WorksheetName);
            cs = new CellStyle();
            if (this._DicQuestionBackgroundColor.ContainsKey(SurveyID))
            {
                if (this._DicQuestionBackgroundColor[SurveyID].ContainsKey(xElement.Attribute("No").Value))
                {
                    cs.SetFontBackGroundColor(this._DicQuestionBackgroundColor[SurveyID][xElement.Attribute("No").Value]);
                    this.dicCellStyles.Add(co, cs);
                }
            }

            return DataBindedSheet;
        }
        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 DataBindedSheet GetAvgScore(XElement xElement, UDT.Hierarchy Hierarchy, Workbook wb)
        {
            DataBindedSheet DataBindedSheet = new DataBindedSheet();

            DataBindedSheet.Worksheet = wb.Worksheets[Hierarchy.Title + "-平均評鑑值"];
            DataBindedSheet.DataTables = new List<DataTable>();
            DataBindedSheet.DataTables.Add(HttpUtility.HtmlDecode(xElement.Attribute("Content").Value).ToDataTable("群組名稱", "群組名稱"));
            DataBindedSheet.DataTables.Add(xElement.Attribute("Score").Value.ToDataTable("評鑑值", "評鑑值"));

            //  評鑑值背景色
            if (this._DicEvaluationBackgroundColor.ContainsKey(this.SurveyID))
            {
                if (this._DicEvaluationBackgroundColor[this.SurveyID].ContainsKey(HttpUtility.HtmlDecode(xElement.Attribute("Content").Value)))
                {
                    CellObject co = new CellObject(0, 0, "評鑑值", DataBindedSheet.Key, this.WorksheetName);
                    CellStyle cs = new CellStyle();
                    cs.SetFontBackGroundColor(this._DicEvaluationBackgroundColor[this.SurveyID][HttpUtility.HtmlDecode(xElement.Attribute("Content").Value)]);
                    dicCellStyles.Add(co, cs);
                }
            }

            return DataBindedSheet;
        }