ckangtai

Ax用Excel导出表的字段属性信息

static void CKT_ExportTableColnum(Args _args)
{
LJD_QaHalf_Figure _LJD_QaHalf_Figure;
SysDictTable sdt;
SysDictField sdf;
Common comn;
int i ,fid;


SysExcelApplication excel;
SysExcelWorkbooks books;
SysExcelWorkbook book;
SysExcelWorksheets sheets;
SysExcelWorksheet sheet;
SysExcelStyles styles;
SysExcelStyle ExcelStyle;
SysExcelFont ExcelFont;
COM comRange, comFont, comColumnWidth, comborders, comborder;


SysdictTable curSysdictTable;
SysDictEnum SDE_LJ_PD_D30_JaxItemType;
SysDictEnum Status_SysDictEnum,Sde_Types;
int row=1;
int col,tableid;
Str creatBy;
System.Exception ex;
RunbaseProgress progress;
#WINAPI
#macrolib.AviFiles

#define.Text("@")
#define.Number("0.00;0.00;;")

 

;

excel = SysExcelApplication::construct();
books = excel.workbooks();
book = books.add();

sheets = book.worksheets();
sheet = sheets.itemFromNum(1);
sheet.name("@LJD127");

tableid = tablenum(LJD_SpmMtlAvgPriceLineTmp);
sdt = new SysDictTable(tableid);

Sde_Types = new SysDictEnum(EnumNum(Types));

for( i = 0 ;i <= sdt.columnCnt() ;i++){
sdf = new SysDictField(tableid,sdt.fieldCnt2Id(i));
//info(strfmt("%1",sdf.isSystem()));
if(!sdf.isSystem()){
fid = sdt.fieldCnt2Id(i);
//info(strfmt("%1__%2__%3", fid,sdt.fieldName(fid),sdf.baseType()));


col = 1;
sheet.cells().item(row,col).value(fid); col++;

sheet.cells().item(row,col).value(sdt.fieldObject(fid).Label()); col++;
sheet.cells().item(row,col).value(sdt.fieldName(fid)); col++;

sheet.cells().item(row,col).value(sdt.fieldObject(fid).labelDefinedLabelId()); col++;

sheet.cells().item(row,col).value(Sde_Types.value2Name(sdt.fieldObject(fid).baseType())); col++;
sheet.cells().item(row,col).value(sdt.fieldObject(fid).tableName()); col++;

sheet.cells().item(row,col).value(sdt.fieldObject(fid).help()); col++;
//sheet.cells().item(row,col).value(enum2str(sdf.baseType())); col++;

row++;
}
}


excel.visible(true);
}

posted on 2018-09-12 08:27  ckangtai  阅读(178)  评论(0编辑  收藏  举报

导航