Exemplo n.º 1
0
        public bool Export()
        {
            IField field;

            if (this.Cursor == null)
            {
                return(false);
            }
            DataTable table  = new DataTable();
            IFields   fields = this.Cursor.Fields;
            int       index  = 0;

            while (index < fields.FieldCount)
            {
                field = fields.get_Field(index);
                if (((field.Type != esriFieldType.esriFieldTypeBlob) &&
                     (field.Type != esriFieldType.esriFieldTypeGeometry)) &&
                    (field.Type != esriFieldType.esriFieldTypeRaster))
                {
                    if (field.Type == esriFieldType.esriFieldTypeOID)
                    {
                        table.Columns.Add(field.Name);
                    }
                    else
                    {
                        table.Columns.Add(field.AliasName);
                    }
                }
                index++;
            }
            object[] values = new object[table.Columns.Count];
            int      num2   = 0;

            for (IRow row = this.Cursor.NextRow(); row != null; row = this.Cursor.NextRow())
            {
                num2 = 0;
                for (index = 0; index < fields.FieldCount; index++)
                {
                    field = fields.get_Field(index);
                    if (((field.Type != esriFieldType.esriFieldTypeBlob) &&
                         (field.Type != esriFieldType.esriFieldTypeGeometry)) &&
                        (field.Type != esriFieldType.esriFieldTypeRaster))
                    {
                        values[num2++] = row.get_Value(index);
                    }
                }
                table.Rows.Add(values);
            }
            if (this.TempleteFile == "")
            {
                YTExportExcel.ExportExcel(false, this.Title, table, this.Title);
            }
            else
            {
                YTExportExcel.ExcelTemplatePrint(false, table, this.TempleteFile, this.Title, this.TempleteStartRowIndex,
                                                 this.TempleteRowCount);
            }
            return(true);
        }
Exemplo n.º 2
0
 public bool Export(DataTable dt)
 {
     if (this.TempleteFile == "")
     {
         YTExportExcel.ExportExcel(false, this.Title, dt, this.Title);
     }
     else
     {
         YTExportExcel.ExcelTemplatePrint(false, dt, this.TempleteFile, this.Title, this.TempleteStartRowIndex,
                                          this.TempleteRowCount);
     }
     return(true);
 }