/// <summary>
        /// 傳回點字頁尾。
        /// </summary>
        /// <param name="lineIdx">目前列印的列索引。用來計算頁尾的文件標題。</param>
        /// <param name="pageNum">頁碼。</param>
        /// <param name="beginOrgPageNum">起始原書頁碼。</param>
        /// <param name="endOrgPageNum">終止原書頁碼。</param>
        /// <returns></returns>
        /// <remarks>注意:點字頁碼的 # 號要固定印在第 37 方的位置(requested by 秋華)</remarks>
        private string GetBraillePageFoot(int lineIdx, int pageNum, int beginOrgPageNum, int endOrgPageNum)
        {
            StringBuilder sb        = new StringBuilder();
            StringBuilder sbPageNum = new StringBuilder();

            // 標題
            BrailleLine titleLine = m_BrDoc.GetPageTitle(lineIdx);
            string      title     = BrailleCharConverter.ToString(titleLine);

            // 原書頁碼
            if (beginOrgPageNum >= 0)
            {
                string orgPageNum = "";
                if (endOrgPageNum < 0)
                {
                    orgPageNum = BrailleCharConverter.GetDigitCharCode(beginOrgPageNum, true);
                }
                else
                {
                    if (beginOrgPageNum == endOrgPageNum)
                    {
                        orgPageNum = BrailleCharConverter.GetDigitCharCode(beginOrgPageNum, true);
                    }
                    else
                    {
                        orgPageNum = BrailleCharConverter.GetDigitCharCode(beginOrgPageNum, true) +
                                     BrailleCharConverter.ToChar(BrailleCell.DotsToByte(3, 6).ToString("X2")) +
                                     BrailleCharConverter.GetDigitCharCode(endOrgPageNum, true);
                    }
                }
                sbPageNum.Append('#');          // 數字點
                sbPageNum.Append(orgPageNum);   // 原書頁碼
                sbPageNum.Append(' ');          // 空方
            }

            sbPageNum.Append('#');      // 數字點
            string pageNumStr = BrailleCharConverter.GetDigitCharCode(pageNum, true);

            sbPageNum.Append(pageNumStr.PadRight(3));   // 點字頁碼的數字部分固定佔三方,亦即 # 固定在第 37 方的位置

            // 計算剩餘可容納標題的空間。
            int roomForTitle = m_BrDoc.CellsPerLine - sbPageNum.Length - 1;  // 多留一個空白

            if (title.Length > roomForTitle)
            {
                title = title.Substring(0, roomForTitle);
            }
            else
            {
                title = title.PadRight(roomForTitle);
            }
            sb.Append(title);                // 標題
            sb.Append(' ');                  // 空方
            sb.Append(sbPageNum.ToString()); // 原書頁碼、點字頁碼

            return(sb.ToString());
        }
        /// <summary>
        /// 產生輸出的點字資料。
        /// </summary>
        /// <returns></returns>
        private StringBuilder GenerateOutputData()
        {
            int           lineCnt = 0;
            int           pageNum = 0;          // 程式內部處理的頁碼
            BrailleLine   brLine;
            StringBuilder sb = new StringBuilder();

            int realLinesPerPage = m_PrintOptions.LinesPerPage;

            if (m_PrintOptions.PrintPageFoot)  // 如需列印頁碼,每頁可印列數便少一列。
            {
                realLinesPerPage--;
            }

            // 計算起始列索引
            int lineIdx = 0;

            if (!m_PrintOptions.AllPages)
            {
                lineIdx = CalcTextLineIndex(m_PrintOptions.FromPage - 1);
            }

            // 準備輸出至點字印表機的資料
            while (lineIdx < m_BrDoc.LineCount)
            {
                brLine = m_BrDoc.Lines[lineIdx];

                SetOrgPageNumber(brLine, (lineCnt % realLinesPerPage == 0));    // 設定起始/終止原書頁碼。

                sb.Append(BrailleCharConverter.ToString(brLine));
                sb.Append(NewLine);     // 每一列後面附加一個換行符號。

                lineCnt++;

                // 列印頁尾資訊:文件標題、原書頁碼、點字頁碼。
                if (lineCnt % realLinesPerPage == 0)   // 已經印滿一頁了?
                {
                    if (m_PrintOptions.PrintPageFoot)  // 是否要印頁尾?
                    {
                        pageNum++;

                        sb.Append(GetBraillePageFoot(lineIdx, m_DisplayedPageNum, m_BeginOrgPageNumber, m_EndOrgPageNumber));

                        AddPageBreak(sb);
                    }

                    m_DisplayedPageNum++;

                    // 每一頁開始列印時,都要把上一頁的終止原書頁碼指定給本頁的起始原書頁碼。
                    if (m_EndOrgPageNumber >= 0)
                    {
                        m_BeginOrgPageNumber = m_EndOrgPageNumber;
                    }

                    if (pageNum >= m_PrintOptions.ToPage)
                    {
                        break;
                    }
                }

                lineIdx++;
            }

            // 補印頁碼
            if (lineCnt % realLinesPerPage != 0)
            {
                pageNum++;

                if (m_PrintOptions.PrintPageFoot)
                {
                    // 用空白列補滿剩餘的頁面
                    int n = realLinesPerPage - (lineCnt % realLinesPerPage);
                    for (int i = 0; i < n; i++)
                    {
                        sb.Append(NewLine);
                    }

                    sb.Append(GetBraillePageFoot(lineIdx, m_DisplayedPageNum, m_BeginOrgPageNumber, m_EndOrgPageNumber));

                    AddPageBreak(sb);
                }
                m_DisplayedPageNum++;
            }

            if (m_PrintOptions.BrSendPageBreakAtEndOfDoc)
            {
                sb.Append(NewPage);
            }

            return(sb);
        }