BCB生成EXCEL表并实现表格的设置数据的填写.doc
《BCB生成EXCEL表并实现表格的设置数据的填写.doc》由会员分享,可在线阅读,更多相关《BCB生成EXCEL表并实现表格的设置数据的填写.doc(7页珍藏版)》请在三一办公上搜索。
1、 /将数据导入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列单元格属性 /设置字号为
2、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);
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(Me
4、rge); 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)
5、.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(ColumnWidt
6、h,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.OlePrope
7、rtyGet(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(Fo
8、nt).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(Cel
9、ls,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,
10、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).
11、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
12、.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(Horizon
13、talAlignment,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(C
14、ells,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(VerticalAl
15、ignment,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=收费金额合计;
16、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(C
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- BCB 生成 EXCEL 实现 表格 设置 数据 填写
链接地址:https://www.31ppt.com/p-2393438.html