社区
C++ Builder
帖子详情
小问题:DBGrid的title内容怎么更改?
pcclever
2003-08-21 04:10:02
想动态的改DBGrid的Title里的Caption的内容。
比如说:第一列原先是"姓名",再在动态改成"序号",该怎么写?
谢谢!
...全文
26
2
打赏
收藏
小问题:DBGrid的title内容怎么更改?
想动态的改DBGrid的Title里的Caption的内容。 比如说:第一列原先是"姓名",再在动态改成"序号",该怎么写? 谢谢!
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
2 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
pcclever
2003-08-21
打赏
举报
回复
成功,谢谢!结贴...
xuv2002
2003-08-21
打赏
举报
回复
DBGrid1->Columns->Items[0]->Title->Caption = "序号";
从0 开始计数为第一列
将
DB
Grid
中的数据快速导出到Excel的控件
发布原因:在网上找了很久也没找到个好用的,不是慢,就是要依赖Excel(必须按装),又找呀找,才找到一个http://blog.csdn.net/xiangding/archive/2003/10/27/16918.aspx,但试了一下,不能用,不知是我用法不对还是本身有
问题
(由于没有给出使用示例),后来找到http://developer.51cto.com/art/200510/7494.htm这个不错,但他又让我装ehlid,不爽,所以对其做了修改,其它也就是去了个加页脚的地方,很爽,有进度条,导完后如果按安装了Excel则直接打开,如果没有的话就不管了,自已想办法打开吧!特点:一、不需安装Excel即可导出。二、有进度条。三、最多可以导出多少条,我没试,我试了5万条没有
问题
,时间也就是只需1-5分钟(我电脑较慢)。四、不需安装组件。使用方法(注:别忘了uses
DB
Grid
ToExcel;):procedure TForm1.btn1Click(Sender: TObject);var
DB
Grid
ToExcel: T
DB
Grid
ToExcel; ExcelFileName: string;begin
DB
Grid
ToExcel := T
DB
Grid
ToExcel.Create(nil); try
DB
Grid
ToExcel.
Title
Name := '入网车辆统计报表';
DB
Grid
ToExcel.BeginDate := '开始日期:2005-07-01';
DB
Grid
ToExcel.EndDate := '结束日期:2005-07-18';
DB
Grid
ToExcel.UserName := '系统管理员';
DB
Grid
ToExcel.
DB
Grid
:=
db
grd1;
DB
Grid
ToExcel.ShowProgress := True; if ExcelFileName = '' then begin ExcelFileName := 'c:\1.xls'; with TSaveDialog.Create(nil) do begin Filter := 'Microsoft Excel xls文件|*.xls'; DefaultExt := 'xls'; if not Execute then Exit else ExcelFileName := FileName; end; end;
DB
Grid
ToExcel.FileName := ExcelFileName;
DB
Grid
ToExcel.Open := False;
DB
Grid
ToExcel.ExportToExcel; finally
DB
Grid
ToExcel.Free; end;end;
RePrint 表格打印轻松做报表 打印datasource,
db
grid
,string
reprint 使用说明 直接从datasource,
db
grid
,string
grid
导入数据, 只需简单设置,不用手工制作,即可生成您需要的报表,具有预览功能。即可自定义纸张,又可适应 打印机默认纸张。各种打印设置,功能更强大。 一 、控件属性: 1、cols
title
设置报表的列标题属性 (1)alignment 列标题对齐方式。 (2)font 列标题字体 (3)print 设置是否打印列标题 (4)rowspace 列标题行的高度 2、datasource 选择要打印的datasource 3、
db
grid
选择要打印的
db
grid
4、string
grid
选择要打印的string
grid
5、detail 设置要打印的明细数据属性 (1)arrange 设置明细字段排列方向 Horizontal 横向打印(默认的一般打印) Vertical 竖向打印(字段竖向排列适合打印字段
内容
较长的报表如“会议纪录”) (2)aotureturn 打印明细字段时,如果字段超过列的宽度是否允许自动换行 (3)colsline 设置竖线属性引用tpen类 (4)footer 设置明细尾 (5)frame 设置明细边框属性引用tpen类 (6)head 设置明细头同footer (7)rowsline 设置横线属性引用tpen类 (8)rowspace 设置明细行的高度 (9)top 明细与标题的距离 6、page 设置纸张的上下左右边距 7、pagefooter 设置页脚同明细尾 8、pageheader 设置页眉同页脚 9、printobject 选择要打印的对象 (datasource 、
db
grid
、 string
grid
) 10、
title
设置标题类页眉、页脚 二 、控件方法: (1) preview 预览 (2) print 打印 (3) SaveToFile() 保存为报表文件 (4) SaveToStream() 保存为流(然后就可把整个报表存到数据库了很方便哦! ~_~) (5) PrintFile() 打印报表文件 (6) PrintStream() 打印流(流的数据库存取就不用多说了吧) (7) PreviewFile() 预览文件 (8) PreviewStream() 预览流 (9) OptionToStream() 报表的属性保存为流 (10) OptionFromStream() 从流中得到报表属性 三、 控件事件: AfterPrint 打印后 BeforePrint 打印前 (本来很多事件,但没有预览,后来加上预览以及一些方法后实现很困难就去掉了!) 四、注意事项 (1) text 属性,输入“¦;#¦;”打印页码值,如果想打印页码可输入“第¦;#¦;页” 输入¦;RecordCount¦;”打印记录数 (2) 不同的打印机,打印和预览效果可能有一点点不同(保证数据打印完全正确一致)。本人用一台针式和一台激光打印机做测试,开始差别较大后经过调试基本一致,不知其他打印机如何。 就这些个吧基本满足了我的软件开发需要,解决了很多
问题
,关键是做报表省了很大力气,当然了很复杂的报表还是要其它报表控件来解决。如果有其他
问题
或好的建议可与我联系。 程序设计:吴进昊 E-mail :jinhaowu@hotmail.com qq :54254770 2003.01.03 新增明细栏的左右对齐. 纸张类型、打印方向设置! 标题的每页打印设置。 列标题的每页,每行打印设置。 修改了打印时的错误!
AC Report中式报表控件V1.83
V1.83新增特性1.增加了TACFormReport控件,可以打印Form上的对象,目前支持打印
DB
Grid
和Dataset,可以轻易扩充。 可以动态设置以下属性: HeaderFont: 列头字体
Grid
Font: 表格字体 PageHeader: 页眉(Rich文本) PageFooter: 页脚(Rich文本) Page
Title
: 页头设置,含文字和字体。 Report
Title
: 表头设置,含文字和字体。 PrintControl: 要打印的控件。 PageInfo: 页面纸张、边距设置。 使用方法: 1) 将对应的TPrint
DB
Grid
Obj或TPrintDataset控件拖到Form上。 2) 通过设置ACFormReport的以上各属性,并调用Prevew、Print、ShowDesigner等方法实现打印或设计功能。2.报表新增了"预览时可改变表格线"和"预览时可以编辑表格
内容
"选项。 "预览时可改变表格线"为默认选项,如果选取了此选项,则在预览时可以重新调整表格的栏宽。3.预览时可以临时设置页面纸张和页边距。4.新增了"页码#"和"总页数#"两个系统变量,因此可以在报表任何位置显示这两个值,而不限于页眉页脚,前提是报表必须在"页面属性"中选取"两遍报表"选项5.其它较重要的修改 1) 预览时可以输入页码直接跳转到某一页。 2) 如果在字段对象后面加上"$",如 "表.字段$",则将返回 "表.字段"的DisplayText值,而不是value值。 3) TACReport新增了TPaperInfo属性,制作动态报表时可以用来动态设置纸张。 4) TACReportCtrl新增了 ReadOnly和
Grid
Reset属性。 5) TACReportCell新增了SetFont方法。 6) 如果Field.Visible=false,则在报表的字段选择中不会出现,但仍然可以使用。注: 1.TACFormReport等新增的几个控件都含源码。2.Demo程序和相关文档有变动。
最新Ehlib 5.2.84(含完整源代码,支持delphi XE)
Ehlib 是著名的数据库连接控制,版本为5.2.84,
DB
grid
增强VCL控件;支持多表头,多固定列,按表头排序,支持合计列,并支持直接打印。可以和PB的ataWindow媲美。 本版本含完整源代码,支持以下 IDE: Delphi 5,6,7,2005 C++Builder 5,6 BDS 2006 (Delphi 2006, C++Builder 2006) Delphi 2007 RAD Studio 2009 (Delphi 2009, C++Builder 2009) Embarcadero RAD Studio 2010 (Delphi 2010, C++Builder 2010) 本人已在Delphi XE中运行通过,在本人编制的进销存软件中应用完全正常。 注:Delphi 2010、XE里面安装不要修改bpl文件的输出路径,采用默认值,否则安装难以成功。 Version 5.2 + Added feature to group data in the
DB
Grid
Eh. It is allowed to make grouping at run-time and design-time. Grouping works only when the
grid
is connected to TMemTableEh dataset. Use next subproperties of
Grid
.DataGrouping property to adjust grouping Active: Boolean - Set this propery true to active grouping. DefaultStateExpanded: Boolean - defines initial expapnding/collapsing state of new created elements of the grouping tree. GroupLevels: T
Grid
DataGroupLevelsEh - Collection of group levels. Use this property to create template of the grouping. GroupPanelVisible: Boolean - Set this property to True to show special panel at the top part of the
grid
. Then the panel is thisible it is allowed to form group levels by mouse. Drag
title
of the requaried column to the group panel and drop it onto panel. Font: TFont - Controls the attributes of the default font of group records in the
grid
. Color: Tcolor - Default background color of the group records. See demonstration project of grouping in Demos\DataGrouping directory. Version 5.1 * The type of RowPanel property was changed. Instead of Boolean type, now it is an object property with subproperies: Active: Boolean - Defines if it is possible to place cells under each over and if every propetry can have personal hight. + NavKeysNavigationType: T
Grid
RowPanelNavKeysNavigationTypeEh - defines the order of navigation over cells in the
grid
when keys Up, Down, Left, Right are pressed. rpntRowT
DB
Grid
中属性修改
DB
Grid
1->Colunms->Items[1]->
Title
->Caption="abc";
C++ Builder
13,824
社区成员
102,679
社区内容
发帖
与我相关
我的任务
C++ Builder
C++ Builder相关内容讨论区
复制链接
扫一扫
分享
社区描述
C++ Builder相关内容讨论区
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章