|
将DW数据窗口导出为EXCEL文件的方法(整理)(10) // 1. 增加对计算列的处理 /**********************************************************/ Int i_cnt String s_colname,s_datatype //清空对象 FOR i_cnt = 1 TO UpperBound(is_columnname) SetNull(is_columnname[i_cnt]) SetNull(is_columntitle[i_cnt]) SetNull(is_columnformat[i_cnt]) SetNull(is_columntype[i_cnt]) END FOR
String s_objects uo_ds_base ds_excel IF NOT IsValid(ds_excel) THEN ds_excel = CREATE uo_ds_base END IF ds_excel.dataobject = 'dw_excel_columns' s_objects = ids_data.Describe("DataWindow.Objects") // 将 DETAIL 区域内的所有可见目标放到 ds_excel 中, // 并按照 object.x 属性大小排序 DO WHILE Len(s_objects) > 0 Int i_pos Long l_x String s_name,s_type,s_band,s_visible,s_objtype String s_objzw,s_zw i_pos = Pos(s_objects, "~t") IF i_pos <= 0 THEN i_pos = Len(s_objects) + 1 // Object 名字 s_name = Left(s_objects,i_pos - 1) s_objects = Mid(s_objects,i_pos + 1, Len(s_objects)) //Object 数据类型 s_type = Lower(ids_data.Describe(s_name + ".coltype")) // Object X 坐标 l_x = Long(ids_data.Describe(s_name + ".x")) // Object 所属区域 s_band = Lower(ids_data.Describe(s_name + ".band")) // Object 是否可见 s_visible = ids_data.Describe(s_name + ".visible") // Object 类别 s_objtype = Lower(ids_data.Describe(s_name + ".type")) // 如果 object 在 Detail 区,且可见,并且是 column 或 Compute Column IF s_band = "detail" AND s_visible = "1" AND & (s_objtype = "column" OR s_objtype = "compute" ) THEN // Object 中文标头,支持标准命名 s_objzw = s_name + "_t" s_zw = ids_data.describe(s_objzw + ".text") // 去掉标题中多余的换行符,空格和引号
|