首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

应用Ole操作Excel打印表格,速度很慢。求教

2012-07-04 
使用Ole操作Excel打印表格,速度很慢。求教就设置了下面这些属性,没有任何其他操作,预览窗口出来前居然需要3

使用Ole操作Excel打印表格,速度很慢。求教
就设置了下面这些属性,没有任何其他操作,预览窗口出来前居然需要3秒以上的时间,请问有没有什么优化方法。

从Excel里可以看到,好像每执行一个属性赋值,Excel就重画一次,状态栏不停闪烁“就绪”,影藏Excel显示设置ScreenUpdating为False也没用,执行这些页面设置用时一样....

表数据很小,唯一的要求就是按照格式打印出来,可这个速度真叫人郁闷了...




C/C++ code
           wb.OlePropertyGet("PageSetup").OlePropertySet("PrintArea", AnsiString(strArea).c_str());//        wb.OlePropertyGet("PageSetup").OlePropertySet("PrintHeadings", false);        wb.OlePropertyGet("PageSetup").OlePropertySet("BlackAndWhite", true);        wb.OlePropertyGet("PageSetup").OlePropertySet("PaperSize", 9);        wb.OlePropertyGet("PageSetup").OlePropertySet("Zoom", false);        wb.OlePropertyGet("PageSetup").OlePropertySet("FitToPagesWide", 1);        wb.OlePropertyGet("PageSetup").OlePropertySet("FitToPagesTall", 1);            // 1纵向,2横向        wb.OlePropertyGet("PageSetup").OlePropertySet("Orientation", Orientation);        wb.OlePropertyGet("PageSetup").OlePropertySet("CenterHorizontally", true);        wb.OlePropertyGet("PageSetup").OlePropertySet("CenterVertically", false);        wb.OlePropertyGet("PageSetup").OlePropertySet("LeftMargin", 0.3);        wb.OlePropertyGet("PageSetup").OlePropertySet("RightMargin", 0.3);        wb.OlePropertyGet("PageSetup").OlePropertySet("TopMargin", 0.3);        wb.OlePropertyGet("PageSetup").OlePropertySet("BottomMargin", 0.3);        wb.OlePropertyGet("PageSetup").OlePropertySet("HeaderMargin", 0.3);        wb.OlePropertyGet("PageSetup").OlePropertySet("FooterMargin", 0.3);


[解决办法]
楼主跑Delphi版问来了?

可以考虑先根据样式设计好模板,然后根据这个模拟新建一个Excel文档,然后将要打印的数据复制过来,再打印.

热点排行