private int GetItemRowCount(QSheet outPut)
 {
     int returnValue = 0;
     foreach (var item in outPut.Items)
     {
         var range = item as QRange;
         if (range != null)
         {
             returnValue += range.RowCount;
         }
         else
         {
             var table = item as QTable;
             if (table != null)
             {
                 if (item is QTable && outPut.ExportCustomColumn)
                 {
                     outPut.BuildRows((QTable)item);
                 }
                 returnValue += table.Rows.Count;
             }
         }
     }
     return returnValue;
 }
        private static void WriteSheet(StringBuilder st, QSheet sheet)
        {
            if (!sheet.ExportCustomColumn)
            {
                sheet.LoadXml();
            }
            QTable table = null;
            foreach (var item in sheet.Items)
            {
                if (item is QTable)
                {
                    table = item as QTable;
                    break;
                }
            }
            if (table == null)
            {
                return;
            }
            var colCount = table.Columns.Count;
            st.Append(" <Worksheet ss:Name=\"" + sheet.SheetText + "\">");
            st.Append(string.Format("  <Table ss:ExpandedColumnCount=\"{0}\" ss:ExpandedRowCount=\"{1}\" x:FullColumns=\"1\" ss:DefaultColumnWidth=\"50\" ss:DefaultRowHeight=\"18\"", colCount.ToString(), table.Rows.Count.ToString()));
            st.Append("   x:FullRows=\"1\">");
            //定义标题的列宽
            for (int n = 0; n < colCount; n++)
            {

                st.Append(string.Format("<Column ss:AutoFitWidth='0' ss:Width='{0}'/>", table.Columns.AllLeafColumns[n].Width * 5));
            }

            //生成标题 ss:MergeAcross='9' ss:StyleID='s75'
            //st.Append("<Row><Cell ss:StyleID=\"s21\"><Data ss:Type=\"String\">" + title + "</Data></Cell></Row>");
            st.Append("<Row><Cell ss:MergeAcross=\"" + (colCount - 1).ToString() + "\" ss:StyleID=\"s10\"><Data ss:Type=\"String\">" + sheet.SheetText + "</Data></Cell></Row>");
            //生成表格标题
            st.Append(ShowDataTableTitleSalary(table.Columns).ToString());
            //生成主体
            st.Append(TurnDataTableToString(table).ToString());
            //生成尾部
            st.Append("  </Table>");
            st.Append("  <WorksheetOptions xmlns=\"urn:schemas-microsoft-com:office:excel\">");
            st.Append("   <Selected/>");
            st.Append("   <Panes>");
            st.Append("    <Pane>");
            st.Append("     <Number>3</Number>");
            st.Append("     <ActiveRow>1</ActiveRow>");
            st.Append("    </Pane>");
            st.Append("   </Panes>");
            st.Append("   <ProtectObjects>False</ProtectObjects>");
            st.Append("   <ProtectScenarios>False</ProtectScenarios>");
            st.Append("  </WorksheetOptions>");
            st.Append(" </Worksheet>");
            st.Append(" <Worksheet ss:Name=\"Sheet2\">");
            st.Append("  <WorksheetOptions xmlns=\"urn:schemas-microsoft-com:office:excel\">");
            st.Append("   <ProtectObjects>False</ProtectObjects>");
            st.Append("   <ProtectScenarios>False</ProtectScenarios>");
            st.Append("  </WorksheetOptions>");
            st.Append(" </Worksheet>");
        }