欢迎来到三一办公! | 帮助中心 三一办公31ppt.com(应用文档模板下载平台)
三一办公
全部分类
  • 办公文档>
  • PPT模板>
  • 建筑/施工/环境>
  • 毕业设计>
  • 工程图纸>
  • 教育教学>
  • 素材源码>
  • 生活休闲>
  • 临时分类>
  • ImageVerifierCode 换一换
    首页 三一办公 > 资源分类 > DOC文档下载  

    BCB生成EXCEL表并实现表格的设置数据的填写.doc

    • 资源ID:2393438       资源大小:46.50KB        全文页数:7页
    • 资源格式: DOC        下载积分:8金币
    快捷下载 游客一键下载
    会员登录下载
    三方登录下载: 微信开放平台登录 QQ登录  
    下载资源需要8金币
    邮箱/手机:
    温馨提示:
    用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)
    支付方式: 支付宝    微信支付   
    验证码:   换一换

    加入VIP免费专享
     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    BCB生成EXCEL表并实现表格的设置数据的填写.doc

    /将数据导入excel表中201010 /保存数据到excel文件中 SaveDialog1->FileName =s_ReportName+EDt.FormatString("yyyymmdd"); if(SaveDialog1->Execute() AnsiString filenamex=SaveDialog1->FileName+".xls" Variant Wb,Sh1; Wb=CreateOleObject("Excel.Sheet"); int i=0; AnsiString cc; Sh1=Wb.OlePropertyGet("ActiveSheet"); /设置1行1列单元格属性 /设置字号为18,粗体 Sh1.PG("Cells",1,1).PG("Font").PS("Size",18); Sh1.PG("Cells",1,1).PG("Font").PS("Bold",true); Sh1.PG("Cells",1,1).PG("Font").PS("Name","宋体"); /设置行高 Sh1.PG("Rows",1).PS("RowHeight",1.155/0.035); / 1/0.035=1cm /合并单元格 Sh1.PG("Range", "A1:K1 ").PR("Merge"); /水平对齐 1:顶端对齐,2:居中, 3:底端对齐 Sh1.PG("Cells",1,1).PS("HorizontalAlignment",3); /垂直对齐 2:左端对齐,3:居中, 4:右端对齐 Sh1.PG("Cells",1,1).PS("VerticalAlignment",2); /设置2行1列单元格属性 /设置字号为18,粗体 Sh1.PG("Cells",2,1).PG("Font").PS("Size",16); Sh1.PG("Cells",2,1).PG("Font").PS("Bold",true); Sh1.PG("Cells",2,1).PG("Font").PS("Name","宋体"); Sh1.PG("Rows",2).PS("RowHeight",1.155/0.035); / 1/0.035=1cm Sh1.PG("Range", "A2:K2 ").PR("Merge"); Sh1.PG("Cells",2,1).PS("HorizontalAlignment",3); Sh1.PG("Cells",2,1).PS("VerticalAlignment",2); /设置3行1列单元格属性 Sh1.PG("Cells",3,1).PG("Font").PS("Size",10); Sh1.PG("Cells",3,1).PG("Font").PS("Bold",true); Sh1.PG("Cells",3,1).PG("Font").PS("Name","宋体"); Sh1.PG("Range", "A3:H3").PR("Merge"); /设置3行9列单元格属性 Sh1.PG("Cells",3,9).PG("Font").PS("Size",10); Sh1.PG("Cells",3,9).PG("Font").PS("Bold",true); Sh1.PG("Cells",3,9).PG("Font").PS("Name","宋体"); Sh1.PG("Rows",3).PS("RowHeight",1/0.035); / 1/0.035=1cm /设置列宽 Sh1.PG("Columns",1).PS("ColumnWidth",5.2); Sh1.PG("Columns",2).PS("ColumnWidth",8); Sh1.PG("Columns",3).PS("ColumnWidth",8.4); Sh1.PG("Columns",4).PS("ColumnWidth",7.6); Sh1.PG("Columns",5).PS("ColumnWidth",7.2); Sh1.PG("Columns",6).PS("ColumnWidth",7.2); Sh1.PG("Columns",7).PS("ColumnWidth",7.2); Sh1.PG("Columns",8).PS("ColumnWidth",7.2); Sh1.PG("Columns",9).PS("ColumnWidth",7.2); Sh1.PG("Columns",10).PS("ColumnWidth",7.2); Sh1.PG("Columns",11).PS("ColumnWidth",6); /填写标题栏 Sh1.OlePropertyGet("Cells",1,1).OlePropertySet("Value",s_StationName); /填写报表名称 Sh1.OlePropertyGet("Cells",2,1).OlePropertySet("Value",s_ReportName); /填写日期栏 Sh1.OlePropertyGet("Cells",3,1).OlePropertySet("Value","报表日期:"+s_ReportDate); Sh1.OlePropertyGet("Cells",3,9).OlePropertySet("Value","单位:RMB 元"); /填写列名称 Sh1.PG("Cells",4,1).PG("Font").PS("Size",10); Sh1.PG("Cells",4,1).PG("Font").PS("Bold",true); Sh1.PG("Cells",4,1).PG("Font").PS("Name","宋体"); Sh1.PG("Cells",4,1).PS("HorizontalAlignment",3); Sh1.PG("Cells",4,1).PS("VerticalAlignment",2); cc="序号" Sh1.OlePropertyGet("Cells",4,1).OlePropertySet("Value",cc); Sh1.PG("Cells",4,2).PG("Font").PS("Size",10); Sh1.PG("Cells",4,2).PG("Font").PS("Bold",true); Sh1.PG("Cells",4,2).PG("Font").PS("Name","宋体"); Sh1.PG("Cells",4,2).PS("HorizontalAlignment",3); Sh1.PG("Cells",4,2).PS("VerticalAlignment",2); cc="车牌号码" Sh1.OlePropertyGet("Cells",4,2).OlePropertySet("Value",cc); Sh1.PG("Cells",4,3).PG("Font").PS("Size",10); Sh1.PG("Cells",4,3).PG("Font").PS("Bold",true); Sh1.PG("Cells",4,3).PG("Font").PS("Name","宋体"); Sh1.PG("Cells",4,3).PS("HorizontalAlignment",3); Sh1.PG("Cells",4,3).PS("VerticalAlignment",2); cc="车队小号" Sh1.OlePropertyGet("Cells",4,3).OlePropertySet("Value",cc); Sh1.PG("Cells",4,4).PG("Font").PS("Size",10); Sh1.PG("Cells",4,4).PG("Font").PS("Bold",true); Sh1.PG("Cells",4,4).PG("Font").PS("Name","宋体"); Sh1.PG("Cells",4,4).PS("HorizontalAlignment",3); Sh1.PG("Cells",4,4).PS("VerticalAlignment",2); cc="车主名称" Sh1.OlePropertyGet("Cells",4,4).OlePropertySet("Value",cc); Sh1.PG("Cells",4,5).PG("Font").PS("Size",10); Sh1.PG("Cells",4,5).PG("Font").PS("Bold",true); Sh1.PG("Cells",4,5).PG("Font").PS("Name","宋体"); Sh1.PG("Cells",4,5).PS("HorizontalAlignment",3); Sh1.PG("Cells",4,5).PS("VerticalAlignment",2); cc="交费次数" Sh1.OlePropertyGet("Cells",4,5).OlePropertySet("Value",cc); Sh1.PG("Cells",4,6).PG("Font").PS("Size",10); Sh1.PG("Cells",4,6).PG("Font").PS("Bold",true); Sh1.PG("Cells",4,6).PG("Font").PS("Name","宋体"); Sh1.PG("Cells",4,6).PS("HorizontalAlignment",3); Sh1.PG("Cells",4,6).PS("VerticalAlignment",2); cc="验票次数" Sh1.OlePropertyGet("Cells",4,6).OlePropertySet("Value",cc); Sh1.PG("Cells",4,7).PG("Font").PS("Size",10); Sh1.PG("Cells",4,7).PG("Font").PS("Bold",true); Sh1.PG("Cells",4,7).PG("Font").PS("Name","宋体"); Sh1.PG("Cells",4,7).PS("HorizontalAlignment",3); Sh1.PG("Cells",4,7).PS("VerticalAlignment",4); cc="单次收费金额" Sh1.OlePropertyGet("Cells",4,7).OlePropertySet("Value",cc); Sh1.PG("Cells",4,8).PG("Font").PS("Size",10); Sh1.PG("Cells",4,8).PG("Font").PS("Bold",true); Sh1.PG("Cells",4,8).PG("Font").PS("Name","宋体"); Sh1.PG("Cells",4,8).PS("HorizontalAlignment",3); Sh1.PG("Cells",4,8).PS("VerticalAlignment",4); cc="通过次数合计" Sh1.OlePropertyGet("Cells",4,8).OlePropertySet("Value",cc); Sh1.PG("Cells",4,9).PG("Font").PS("Size",10); Sh1.PG("Cells",4,9).PG("Font").PS("Bold",true); Sh1.PG("Cells",4,9).PG("Font").PS("Name","宋体"); Sh1.PG("Cells",4,9).PS("HorizontalAlignment",3); Sh1.PG("Cells",4,9).PS("VerticalAlignment",4); cc="收费金额合计" Sh1.OlePropertyGet("Cells",4,9).OlePropertySet("Value",cc); Sh1.PG("Cells",4,10).PG("Font").PS("Size",10); Sh1.PG("Cells",4,10).PG("Font").PS("Bold",true); Sh1.PG("Cells",4,10).PG("Font").PS("Name","宋体"); Sh1.PG("Cells",4,10).PS("HorizontalAlignment",3); Sh1.PG("Cells",4,10).PS("VerticalAlignment",4); cc="卡内余额" Sh1.OlePropertyGet("Cells",4,10).OlePropertySet("Value",cc); Sh1.PG("Cells",4,11).PG("Font").PS("Size",10); Sh1.PG("Cells",4,11).PG("Font").PS("Bold",true); Sh1.PG("Cells",4,11).PG("Font").PS("Name","宋体"); Sh1.PG("Cells",4,11).PS("HorizontalAlignment",3); Sh1.PG("Cells",4,11).PS("VerticalAlignment",2); cc="备注" Sh1.OlePropertyGet("Cells",4,11).OlePropertySet("Value",cc); i=4; cardcnt=0; while (!DataModules->ADOQuery->Eof) i+; cardcnt+; /填写列内容 Sh1.PG("Cells",i,1).PG("Font").PS("Size",10); Sh1.PG("Cells",i,1).PG("Font").PS("Name","宋体"); Sh1.PG("Cells",i,1).PS("HorizontalAlignment",3); Sh1.PG("Cells",i,1).PS("VerticalAlignment",2); cc= IntToStr(cardcnt); Sh1.OlePropertyGet("Cells",i,1).OlePropertySet("Value",cc); Sh1.PG("Cells",i,2).PG("Font").PS("Size",10); Sh1.PG("Cells",i,2).PG("Font").PS("Name","宋体"); Sh1.PG("Cells",i,2).PS("HorizontalAlignment",3); Sh1.PG("Cells",i,2).PS("VerticalAlignment",2); cc= DataModules->ADOQuery->Fields->FieldByName("CPUVLPNumber")->AsString.Trim(); Sh1.OlePropertyGet("Cells",i,2).OlePropertySet("Value",cc); Sh1.PG("Cells",i,3).PG("Font").PS("Size",10); Sh1.PG("Cells",i,3).PG("Font").PS("Name","宋体"); Sh1.PG("Cells",i,3).PS("HorizontalAlignment",3); Sh1.PG("Cells",i,3).PS("VerticalAlignment",2); cc= DataModules->ADOQuery->Fields->FieldByName("CPUSVLPNumber")->AsString.Trim(); Sh1.OlePropertyGet("Cells",i,3).OlePropertySet("Value",cc); Sh1.PG("Cells",i,4).PG("Font").PS("Size",10); Sh1.PG("Cells",i,4).PG("Font").PS("Name","宋体"); Sh1.PG("Cells",i,4).PS("HorizontalAlignment",3); Sh1.PG("Cells",i,4).PS("VerticalAlignment",2); cc= DataModules->ADOQuery->Fields->FieldByName("CardOwnerName")->AsString.Trim(); Sh1.OlePropertyGet("Cells",i,4).OlePropertySet("Value",cc); Sh1.PG("Cells",i,5).PG("Font").PS("Size",10); Sh1.PG("Cells",i,5).PG("Font").PS("Name","宋体"); Sh1.PG("Cells",i,5).PS("HorizontalAlignment",3); Sh1.PG("Cells",i,5).PS("VerticalAlignment",2); TotalJFCnt+=DataModules->ADOQuery->Fields->FieldByName("AutoType")->AsInteger; cc= IntToStr(DataModules->ADOQuery->Fields->FieldByName("AutoType")->AsInteger); Sh1.OlePropertyGet("Cells",i,5).OlePropertySet("Value",cc); Sh1.PG("Cells",i,6).PG("Font").PS("Size",10); Sh1.PG("Cells",i,6).PG("Font").PS("Name","宋体"); Sh1.PG("Cells",i,6).PS("HorizontalAlignment",3); Sh1.PG("Cells",i,6).PS("VerticalAlignment",2); TotalYPCnt+=DataModules->ADOQuery->Fields->FieldByName("YapCount")->AsInteger; cc= IntToStr(DataModules->ADOQuery->Fields->FieldByName("YapCount")->AsInteger); Sh1.OlePropertyGet("Cells",i,6).OlePropertySet("Value",cc); Sh1.PG("Cells",i,7).PG("Font").PS("Size",10); Sh1.PG("Cells",i,7).PG("Font").PS("Name","宋体"); Sh1.PG("Cells",i,7).PS("HorizontalAlignment",3); Sh1.PG("Cells",i,7).PS("VerticalAlignment",4); cc= IntToStr(DataModules->ADOQuery->Fields->FieldByName("Price")->AsInteger); Sh1.OlePropertyGet("Cells",i,7).OlePropertySet("Value",cc); Sh1.PG("Cells",i,8).PG("Font").PS("Size",10); Sh1.PG("Cells",i,8).PG("Font").PS("Name","宋体"); Sh1.PG("Cells",i,8).PS("HorizontalAlignment",3); Sh1.PG("Cells",i,8).PS("VerticalAlignment",2); TotalTGCnt+=DataModules->ADOQuery->Fields->FieldByName("AutoType")->AsInteger+DataModules->ADOQuery->Fields->FieldByName("YapCount")->AsInteger; cc= IntToStr(DataModules->ADOQuery->Fields->FieldByName("AutoType")->AsInteger+DataModules->ADOQuery->Fields->FieldByName("YapCount")->AsInteger); Sh1.OlePropertyGet("Cells",i,8).OlePropertySet("Value",cc); Sh1.PG("Cells",i,9).PG("Font").PS("Size",10); Sh1.PG("Cells",i,9).PG("Font").PS("Name","宋体"); Sh1.PG("Cells",i,9).PS("HorizontalAlignment",3); Sh1.PG("Cells",i,9).PS("VerticalAlignment",2); TotalJFPrice+=DataModules->ADOQuery->Fields->FieldByName("AutoType")->AsInteger*DataModules->ADOQuery->Fields->FieldByName("Price")->AsInteger; cc= IntToStr(DataModules->ADOQuery->Fields->FieldByName("AutoType")->AsInteger*DataModules->ADOQuery->Fields->FieldByName("Price")->AsInteger); Sh1.OlePropertyGet("Cells",i,9).OlePropertySet("Value",cc); Sh1.PG("Cells",i,10).PG("Font").PS("Size",10); Sh1.PG("Cells",i,10).PG("Font").PS("Name","宋体"); Sh1.PG("Cells",i,10).PS("HorizontalAlignment",3); Sh1.PG("Cells",i,10).PS("VerticalAlignment",2); cc= IntToStr(DataModules->ADOQuery->Fields->FieldByName("RestCost")->AsInteger); Sh1.OlePropertyGet("Cells",i,10).OlePropertySet("Value",cc); DataModules->ADOQuery->Next(); /交费次数合计 Sh1.PG("Cells",cardcnt+5,5).PG("Font").PS("Size",10); Sh1.PG("Cells",cardcnt+5,5).PG("Font").PS("Bold",true); Sh1.PG("Cells",cardcnt+5,5).PG("Font").PS("Name","宋体"); Sh1.PG("Cells",cardcnt+5,5).PS("HorizontalAlignment",3); Sh1.PG("Cells",cardcnt+5,5).PS("VerticalAlignment",4); /利用excel中的函数进行求和运算 cc= "=SUM(E5:E"+IntToStr(cardcnt+4)+ ") " Sh1.OlePropertyGet("Cells",cardcnt+5,5).OlePropertySet("Value",cc); . /设置打印页边距:上 下 左 右 水平 垂直 Sh1.PG("PageSetup").PS("TopMargin",2.0/0.035); Sh1.PG("PageSetup").PS("BottomMargin",2.0/0.035); Sh1.PG("PageSetup").PS("LeftMargin",1.0/0.035); Sh1.PG("PageSetup").PS("RightMargin",1.0/0.035); Sh1.PG("PageSetup").PS("CenterHorizontally",1.5/0.035); /Sh1.PG("PageSetup").PS("CenterVertically",1.5/0.035); /Sh1.PG("PageSetup").PS("PrintGridLines",true); /画边框表格 Variant ERange,EBorders; AnsiString strRange; strRange = "A"+IntToStr(4)+":K"+IntToStr(cardcnt+5); /获取操作范围 ERange = Sh1.OlePropertyGet("Range",strRange.c_str(); EBorders = ERange.OlePropertyGet("Borders");

    注意事项

    本文(BCB生成EXCEL表并实现表格的设置数据的填写.doc)为本站会员(仙人指路1688)主动上传,三一办公仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知三一办公(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    备案号:宁ICP备20000045号-2

    经营许可证:宁B2-20210002

    宁公网安备 64010402000987号

    三一办公
    收起
    展开