http://dev.csdn.net/article/53/53442.shtm
如何将几个dbgrid里的内容导入同一个excel表中? 【程序编程相关:我用Delphi实现的Singleton】 【推荐阅读:[强烈推荐]Mini Delphi 20】在软件实际制作中,为节省开发成本与开发周期,一些软件人员通常会吧dbgrid中的数据直接导出到excel表中,而先前能看到的函数仅仅只能在workbook的一个sheet中导入数据,不支持多sheet!. 【扩展信息:让Fastreport3.x支持中文PD】~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
单元应用:
windows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs, stdctrls, db, dbtables, grids, dbgrids, activex, comobj, excel2000, oleserver;procedure copydbdatatoexcel(args: array of const);
var icount, jcount: integer; xlapp: variant; sheet: variant; i: integer; begin screen.cursor := crhourglass; if not varisempty(xlapp) then begin xlapp.displayalerts := false; xlapp.quit; varclear(xlapp); end;try
xlapp := createoleobject(‘excel.application‘); except screen.cursor := crdefault; exit; end;xlapp.workbooks.add;// (1)
... 下一页