예제 #1
0
        private DataTable BuildExportTable(DataTable SourceTable, ExportFormat xFmt)
        {
            ArrayList cols         = new ArrayList();
            ArrayList validColumns = new ArrayList();

            foreach (formatColumn fRow in xFmt.fmtCols)
            {
                if (fRow.Enabled)
                {
                    string colName = fRow.ColumnName;
                    if (SourceTable.Columns.IndexOf(colName) > -1)
                    {
                        cols.Add(colName);
                        validColumns.Add(fRow);
                    }
                }
            }
            DataTable tmp = xFmt.CreateTempTable();

            foreach (DataRow sRow in SourceTable.Rows)
            {
                DataRow nr = tmp.NewRow();
                foreach (formatColumn col in validColumns)
                {
                    nr[col.refColumnName] = DB.RowField(sRow, col.ColumnName);
                }
                tmp.Rows.Add(nr);
            }
            return(tmp);
        }