• pb数据导出


    1.在窗口新建用户事件 ue_export
    2.事件调用函数 gf_dw_to_excel(THIS.dw_dict)
    3.写函数 :boolean lb_setborder
    boolean lb_mergecolumnheader
    boolean lb_setmaxrow
    string ls_objname
    string ls_borderbeinobj
    string ls_borderendobj
    string ls_filename
    integer li_printheader
    n_cst_dw2excel n_excel
    string ls_path
    string ls_file
    integer li_rc
    li_rc = getfilesavename("请选择你要保存的文件名称",ls_path,ls_file,"xls","All Files (*.xls),*.xls","d:",32770)
    IF li_rc = 1 THEN //1
    ls_filename = ls_path
    END IF //1
    n_excel.of_setgridborder(lb_setborder,ls_borderbeinobj,ls_borderendobj)
    n_excel.of_mergecolumnheader(lb_mergecolumnheader,ls_objname)
    n_excel.of_setprintheader(li_printheader)
    n_excel.of_settipswindow("w_tipsabc","正在生成Excel文件,请稍候.....")
    n_excel.of_dw2excel(dw_export_exlcel,ls_filename)
    4.窗口的导出按钮触发事件
    PARENT.triggerevent("ue_export")
    RETURN

    保存到Excel文件中
    OLEObject ole_object , ole_workbooks
    ole_object = CREATE OLEObject
    IF ole_object.ConnectToNewObject("Excel.Application") <> 0 THEN
    MessageBox('OLE错误','OLE无法连接!')
    return
    END IF
    ole_object.workbooks.add
    ole_object.Visible = True
    ole_workbooks = ole_object.Worksheets(1)
    ole_workbooks.cells(1,1).value="任务号"
    ole_workbooks.cells(1,2).value="次序"
    ole_workbooks.cells(1,3).value="步数"
    ole_workbooks.cells(1,4).value="机器号"
    ole_workbooks.cells(1,5).value="开始时间"
    ole_workbooks.cells(1,6).value="结束时间"
    long l_row
    for l_row = 2 to dw_1.rowcount()
    ole_workbooks.cells(l_row,1).value=dw_1.getitemstring(l_row,1)
    ole_workbooks.cells(l_row,2).value=dw_1.getitemnumber(l_row,2)
    ole_workbooks.cells(l_row,3).value=dw_1.getitemnumber(l_row,3)
    ole_workbooks.cells(l_row,4).value=dw_1.getitemnumber(l_row,4)
    ole_workbooks.cells(l_row,5).value=dw_1.getitemtime(l_row,5)
    ole_workbooks.cells(l_row,6).value=dw_1.getitemtime(l_row,6)
    next
    ole_workbooks.SaveAs ("d:data.xls")
    ole_object.quit()
    Ole_Object.DisConnectObject()
    Destroy Ole_Object
    destroy ole_workbooks

    基本的PB知识学习之路
  • 相关阅读:
    jQuery .attr() vs .prop()
    新手學python之新體驗
    [pymongo] pymongo.errors.CursorNotFound Exception
    javascript Round Function
    .net Core 3 preview 3试用 WPF,winform桌面开发
    Rendering Transparent 3D Surfaces in WPF with C#(转载)
    jQuery 属性方法 总结
    jQuery 选择器总结
    js + css 实现标签内容切换功能
    初识javascript 之 函数:function
  • 原文地址:https://www.cnblogs.com/IT-XiaoBao/p/13485580.html
Copyright © 2020-2023  润新知