统计报表
┏━━━┳━━━━┳━━━━┓
┃ ┃ 项目1 ┃项目2 ┃
┣━━━╋━━━━╋━━━━┫
┃行 1 ┃ 内容 ┃内容 ┃
┣━━━╋━━━━╋━━━━┫
┃行 2 ┃ 内容 ┃内容 ┃
┣━━━╋━━━━╋━━━━┫
┃行 3 ┃ 内容 ┃内容 ┃
┗━━━┻━━━━┻━━━━┛
统计人:某某某
日期:
2)打印的页面设置要能选择纵向或横向,纸张选择A4/A3
48 个解决方案
#1
我自己做了一个从DBGridEh表格选择表格栏处理到excel的控件,并且可以生成打印fastreport报表,在fastreport打印时可以打印的页面设置要能选择纵向或横向,但没有做纸张选择A4/A3,只做了a4下的纵向或横向选择
若要给我留下email
若要给我留下email
#2
请楼上的兄弟也给我发一份!
liwei@tydic.com
先谢了!
liwei@tydic.com
先谢了!
#3
me too
ghiewa@etang.com
ghiewa@etang.com
#4
qkd@xinhuanet.com
#5
wayenlee@citiz.net
我也要,谢谢
我也要,谢谢
#6
cao_bf@163.com
我也要啊,谢谢了
我也要啊,谢谢了
#7
sydt@sina.com
我也要,谢谢!!!
我也要,谢谢!!!
#8
ratmove@tom.com谢谢,谢谢我也需要,麻烦了!!!
#9
andy_qhz@163.net thank you
#10
赫赫,谢谢了,兄弟!
lycloud1978@163.com
lycloud1978@163.com
#11
还要等到什么时候啊?快发吧。qkd@xinhuanet.com
#12
kvyd@163.com
多谢啦
abis.vicp.net
多谢啦
abis.vicp.net
#13
给我也发一份吧:lcj49997@yeah.net
#14
谢稿,能否也给你一份!
#15
send to all
#16
给我一份吧,谢谢!
xrf@vip.sina.com
xrf@vip.sina.com
#17
ok xrfei(相如飞)
#18
mrchenjinghong@163.com
给我一份谢谢
给我一份谢谢
#19
谢谢了,能给我发一份吗?
qiuqiu_xu123@163.com
qiuqiu_xu123@163.com
#20
谢谢了,能给我发一份吗?
isys@yeah.net
isys@yeah.net
#21
我在这里做慈善了,哈哈
#22
用F1Book控件啊
#23
我要一个
发给我吧
xhusa@163.com
发给我吧
xhusa@163.com
#24
我受到了,还不会用呢
#25
谢谢,lmj_hit@163.net
#26
呵呵!
#27
我怎么装不上啊,有装上的没有啊,请告诉小弟怎么安装啊。我装了FastReport还是装不上:
[C++ Error] report_dlgx.h(10): E2209 Unable to open include file 'DBGridEh.hpp'
[C++ Error] report_dlgx.h(66): E2303 Type name expected
。。。。。。。。。。。。。。
[C++ Error] report_dlgx.h(10): E2209 Unable to open include file 'DBGridEh.hpp'
[C++ Error] report_dlgx.h(66): E2303 Type name expected
。。。。。。。。。。。。。。
#28
to:houzy123(houzy123)
我也要一份
cptang@263.net
我也要一份
cptang@263.net
#29
lvjack@sohu.com
要的人这么多,老兄要不挂到chinabcb去然后给个链接
要的人这么多,老兄要不挂到chinabcb去然后给个链接
#30
我也要一份
yangjinhui2000@163.com
yangjinhui2000@163.com
#31
关注
#32
各位,此控件是fastreport下处理DBGridEh的打印问题,同时可以将其另存为excel,所以你要安装有DBGridEh方可使用,若要处理DBGrid表格,你可以修改原代码#include "DBGridEh.hpp"和DBGridEh的link并且修改TDBGridEh *myDBGridEh;为TDBGrid *myDBGridEh;
#33
发一分吧!
liuyong@sanycom.com
THX
liuyong@sanycom.com
THX
#34
以下是ChinaBcb.风吹斜阳 的解答,大家转贴的时候保持完整
========================================================================
在一次开发中,我应某些人的要求,要将数据库中的数据导出至EXCEL进一步处理,为了不想让自己成为某些人眼中的弱智职员。我答应了下来,谁知噩梦开始了……
开始我准备用BCB组件Office2k页中的ExcelApplication来控制Excel,我在实际开发中发现如果添加一些组件的话,程序根本编译不过,出现以下错误信息:
Build
[C++ Error] ComCtrls.hpp(2638): E2015 Ambiguity between 'Windows' and 'Excel_2k::Windows'
[C++ Error] ComCtrls.hpp(2839): E2015 Ambiguity between 'Windows' and 'Excel_2k::Windows'
[C++ Error] ComCtrls.hpp(3430): E2015 Ambiguity between 'Menus' and 'Excel_2k::Menus'
[C++ Error] ComCtrls.hpp(3431): E2015 Ambiguity between 'Menus' and 'Excel_2k::Menus'
[C++ Error] ComCtrls.hpp(3435): E2015 Ambiguity between 'Menus' and 'Excel_2k::Menus'
[C++ Error] ComCtrls.hpp(3477): E2015 Ambiguity between 'Menus' and 'Excel_2k::Menus'
[C++ Error] ComCtrls.hpp(3577): E2015 Ambiguity between 'Menus' and 'Excel_2k::Menus'
[C++ Error] ComCtrls.hpp(3640): E2015 Ambiguity between 'Menus' and 'Excel_2k::Menus'
[C++ Error] ComCtrls.hpp(3641): E2015 Ambiguity between 'Menus' and 'Excel_2k::Menus'
[C++ Error] ComCtrls.hpp(3652): E2015 Ambiguity between 'Menus' and 'Excel_2k::Menus'
[C++ Error] ComCtrls.hpp(3657): E2015 Ambiguity between 'Menus' and 'Excel_2k::Menus'
[C++ Error] ComCtrls.hpp(3699): E2015 Ambiguity between 'Menus' and 'Excel_2k::Menus'
[C++ Error] ComCtrls.hpp(3706): E2015 Ambiguity between 'Menus' and 'Excel_2k::Menus'
[C++ Error] ComCtrls.hpp(4140): E2015 Ambiguity between 'Windows' and 'Excel_2k::Windows'
[C++ Error] ComCtrls.hpp(4259): E2015 Ambiguity between 'Windows' and 'Excel_2k::Windows'
[C++ Error] ComCtrls.hpp(4429): E2015 Ambiguity between 'Windows' and 'Excel_2k::Windows'
[C++ Error] DBCtrls.hpp(1075): E2015 Ambiguity between 'Buttons' and 'Excel_2k::Buttons'
[C++ Error] DBCtrls.hpp(1077): E2015 Ambiguity between 'Buttons' and 'Excel_2k::Buttons'
[C++ Error] DBCtrls.hpp(1096): E2015 Ambiguity between 'Buttons' and 'Excel_2k::Buttons'
[C++ Error] DBGrids.hpp(62): E2015 Ambiguity between 'Menus' and 'Excel_2k::Menus'
[C++ Error] DBGrids.hpp(102): E2015 Ambiguity between 'Menus' and 'Excel_2k::Menus'
[C++ Error] DBGrids.hpp(148): E2015 Ambiguity between 'Menus' and 'Excel_2k::Menus'
真是太牛了,我开始以为是BCB秀逗了,重新安装都不行,我当时不知道为什么,到这篇文章出来的时候还是不知道。如果我知道是为什么,我会公布的。现在研究中。如果有那位大侠知道了,也请贴出来,在此谢过!
在没有解决这个问题之前,我曾经想哭,但我没有哭。哭并不是技术上的难题解决不了,而是…………,我真的不想再提起。幸好现在解决了,呵呵,我还不算在某些人眼中的弱智。
好了,不说废话了。下面正式进入话题。以下程序代码是在某些人要求编写的大型MIS系统中移植下来的,以下代码基于BDE。如果不知道怎么配置BDE,就找本书看吧。这里将不在废话了!
以下代码均在Widows 2000 Advance Server BCB6.0中编译通过!运行成功!开香槟吧!呵呵!
在BCB中新建一个Application,Application中用了以下一些控件:Query DataSource DBGrid Bitbtn。其主要属性设置如下:
Query1->SQL值为select * from Example,Query1的Active可以在窗体创建时设置,在这里我设为True,因为我的数据库才一条数据,*^-^*
DataSource->DataSource指向Query1
DBGrid1->DataSource 指向DataSource1
Bitbtn1找副好图片吧,Bitbtn2->Kind 为bkClose 我总得要退出是吧!呵呵。
数据库的结构:
Field name Type Size Key
Id A 5 *
Name A 8
Sex A 2
Addr A 20
结构有点乱,嗯,反正是示范数据库,没有实际价值。所以我没有再调整了,将就着用吧!
代码部分:
头文件代码:
//---------------------------------------------------------------------------
#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <DB.hpp>
#include <DBGrids.hpp>
#include <DBTables.hpp>
#include <Grids.hpp>
#include <Buttons.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published: // IDE-managed Components
TQuery *Query1;
TDataSource *DataSource1;
TDBGrid *DBGrid1;
TBitBtn *BitBtn1;
TBitBtn *BitBtn2;
void __fastcall BitBtn1Click(TObject *Sender);
private: // User declarations
public: // User declarations
__fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif
//CPP文件代码
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::BitBtn1Click(TObject *Sender)
{
Query1->Close();
Query1->Open();
if (Query1->IsEmpty()) //判断数据源是否有数据,如果没有数据还干什么,是吧!
{
MessageBox(Handle,"没有数据,我要退出了","错误",MB_OK|MB_ICONINFORMATION);
return;
}
Variant Excel;
Variant ExcelBook;
Variant ExcelSheet;
long Row;
AnsiString Id,Name,Sex,Addr;
try
{
//开始启动EXCEL
Excel=Variant::CreateObject("Excel.Application");
}
catch(...) //这样捕捉异常惯了,所以…………
{
//麻烦了,好像没有EXCEL程序
MessageBox(Handle,"不是吧,好像没有EXCEL耶,检查一下吧","错误",MB_OK|MB_ICONERROR);
return; //没有Excel我就走了
}
//此处的 true 为小写,注意
Excel.OlePropertySet("Visible",true);
ExcelBook=Excel.OlePropertyGet("workbooks");
ExcelSheet=ExcelBook.OleFunction("add");
ExcelBook=Excel.OlePropertyGet("ActiveWorkBook");
ExcelSheet=ExcelBook.OlePropertyGet("ActiveSheet");
ExcelSheet.OlePropertyGet("Cells",1,1).OlePropertySet("Value","如果你见过这个信息的话,代表成功");
ExcelSheet.OlePropertyGet("Cells",2,1).OlePropertySet("Value","代号");
ExcelSheet.OlePropertyGet("Cells",2,2).OlePropertySet("Value","姓名");
ExcelSheet.OlePropertyGet("Cells",2,3).OlePropertySet("Value","性别");
ExcelSheet.OlePropertyGet("Cells",2,4).OlePropertySet("Value","地址");
Row=3;
Query1->First();
//开始复制数据
//此处没有采异常捕捉了,呵呵,应该不会有错吧,反正我是没有碰到过
while(!Query1->Eof)
{
Id=Query1->FieldByName("id")->AsString;
Name=Query1->FieldByName("Name")->AsString;
Sex=Query1->FieldByName("Sex")->AsString;
Addr=Query1->FieldByName("Addr")->AsString;
//开始填充数据
ExcelSheet.OlePropertyGet("Cells",Row,1).OlePropertySet("Value",Id.c_str());
ExcelSheet.OlePropertyGet("Cells",Row,2).OlePropertySet("Value",Name.c_str());
ExcelSheet.OlePropertyGet("Cells",Row,3).OlePropertySet("Value",Sex.c_str());
ExcelSheet.OlePropertyGet("Cells",Row,4).OlePropertySet("Value",Addr.c_str());
Query1->Next();
++Row;
}
}
//---------------------------------------------------------------------------
以上文字如需转载,请保持完整性。风吹斜阳 共享,进步!
========================================================================
在一次开发中,我应某些人的要求,要将数据库中的数据导出至EXCEL进一步处理,为了不想让自己成为某些人眼中的弱智职员。我答应了下来,谁知噩梦开始了……
开始我准备用BCB组件Office2k页中的ExcelApplication来控制Excel,我在实际开发中发现如果添加一些组件的话,程序根本编译不过,出现以下错误信息:
Build
[C++ Error] ComCtrls.hpp(2638): E2015 Ambiguity between 'Windows' and 'Excel_2k::Windows'
[C++ Error] ComCtrls.hpp(2839): E2015 Ambiguity between 'Windows' and 'Excel_2k::Windows'
[C++ Error] ComCtrls.hpp(3430): E2015 Ambiguity between 'Menus' and 'Excel_2k::Menus'
[C++ Error] ComCtrls.hpp(3431): E2015 Ambiguity between 'Menus' and 'Excel_2k::Menus'
[C++ Error] ComCtrls.hpp(3435): E2015 Ambiguity between 'Menus' and 'Excel_2k::Menus'
[C++ Error] ComCtrls.hpp(3477): E2015 Ambiguity between 'Menus' and 'Excel_2k::Menus'
[C++ Error] ComCtrls.hpp(3577): E2015 Ambiguity between 'Menus' and 'Excel_2k::Menus'
[C++ Error] ComCtrls.hpp(3640): E2015 Ambiguity between 'Menus' and 'Excel_2k::Menus'
[C++ Error] ComCtrls.hpp(3641): E2015 Ambiguity between 'Menus' and 'Excel_2k::Menus'
[C++ Error] ComCtrls.hpp(3652): E2015 Ambiguity between 'Menus' and 'Excel_2k::Menus'
[C++ Error] ComCtrls.hpp(3657): E2015 Ambiguity between 'Menus' and 'Excel_2k::Menus'
[C++ Error] ComCtrls.hpp(3699): E2015 Ambiguity between 'Menus' and 'Excel_2k::Menus'
[C++ Error] ComCtrls.hpp(3706): E2015 Ambiguity between 'Menus' and 'Excel_2k::Menus'
[C++ Error] ComCtrls.hpp(4140): E2015 Ambiguity between 'Windows' and 'Excel_2k::Windows'
[C++ Error] ComCtrls.hpp(4259): E2015 Ambiguity between 'Windows' and 'Excel_2k::Windows'
[C++ Error] ComCtrls.hpp(4429): E2015 Ambiguity between 'Windows' and 'Excel_2k::Windows'
[C++ Error] DBCtrls.hpp(1075): E2015 Ambiguity between 'Buttons' and 'Excel_2k::Buttons'
[C++ Error] DBCtrls.hpp(1077): E2015 Ambiguity between 'Buttons' and 'Excel_2k::Buttons'
[C++ Error] DBCtrls.hpp(1096): E2015 Ambiguity between 'Buttons' and 'Excel_2k::Buttons'
[C++ Error] DBGrids.hpp(62): E2015 Ambiguity between 'Menus' and 'Excel_2k::Menus'
[C++ Error] DBGrids.hpp(102): E2015 Ambiguity between 'Menus' and 'Excel_2k::Menus'
[C++ Error] DBGrids.hpp(148): E2015 Ambiguity between 'Menus' and 'Excel_2k::Menus'
真是太牛了,我开始以为是BCB秀逗了,重新安装都不行,我当时不知道为什么,到这篇文章出来的时候还是不知道。如果我知道是为什么,我会公布的。现在研究中。如果有那位大侠知道了,也请贴出来,在此谢过!
在没有解决这个问题之前,我曾经想哭,但我没有哭。哭并不是技术上的难题解决不了,而是…………,我真的不想再提起。幸好现在解决了,呵呵,我还不算在某些人眼中的弱智。
好了,不说废话了。下面正式进入话题。以下程序代码是在某些人要求编写的大型MIS系统中移植下来的,以下代码基于BDE。如果不知道怎么配置BDE,就找本书看吧。这里将不在废话了!
以下代码均在Widows 2000 Advance Server BCB6.0中编译通过!运行成功!开香槟吧!呵呵!
在BCB中新建一个Application,Application中用了以下一些控件:Query DataSource DBGrid Bitbtn。其主要属性设置如下:
Query1->SQL值为select * from Example,Query1的Active可以在窗体创建时设置,在这里我设为True,因为我的数据库才一条数据,*^-^*
DataSource->DataSource指向Query1
DBGrid1->DataSource 指向DataSource1
Bitbtn1找副好图片吧,Bitbtn2->Kind 为bkClose 我总得要退出是吧!呵呵。
数据库的结构:
Field name Type Size Key
Id A 5 *
Name A 8
Sex A 2
Addr A 20
结构有点乱,嗯,反正是示范数据库,没有实际价值。所以我没有再调整了,将就着用吧!
代码部分:
头文件代码:
//---------------------------------------------------------------------------
#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <DB.hpp>
#include <DBGrids.hpp>
#include <DBTables.hpp>
#include <Grids.hpp>
#include <Buttons.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published: // IDE-managed Components
TQuery *Query1;
TDataSource *DataSource1;
TDBGrid *DBGrid1;
TBitBtn *BitBtn1;
TBitBtn *BitBtn2;
void __fastcall BitBtn1Click(TObject *Sender);
private: // User declarations
public: // User declarations
__fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif
//CPP文件代码
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::BitBtn1Click(TObject *Sender)
{
Query1->Close();
Query1->Open();
if (Query1->IsEmpty()) //判断数据源是否有数据,如果没有数据还干什么,是吧!
{
MessageBox(Handle,"没有数据,我要退出了","错误",MB_OK|MB_ICONINFORMATION);
return;
}
Variant Excel;
Variant ExcelBook;
Variant ExcelSheet;
long Row;
AnsiString Id,Name,Sex,Addr;
try
{
//开始启动EXCEL
Excel=Variant::CreateObject("Excel.Application");
}
catch(...) //这样捕捉异常惯了,所以…………
{
//麻烦了,好像没有EXCEL程序
MessageBox(Handle,"不是吧,好像没有EXCEL耶,检查一下吧","错误",MB_OK|MB_ICONERROR);
return; //没有Excel我就走了
}
//此处的 true 为小写,注意
Excel.OlePropertySet("Visible",true);
ExcelBook=Excel.OlePropertyGet("workbooks");
ExcelSheet=ExcelBook.OleFunction("add");
ExcelBook=Excel.OlePropertyGet("ActiveWorkBook");
ExcelSheet=ExcelBook.OlePropertyGet("ActiveSheet");
ExcelSheet.OlePropertyGet("Cells",1,1).OlePropertySet("Value","如果你见过这个信息的话,代表成功");
ExcelSheet.OlePropertyGet("Cells",2,1).OlePropertySet("Value","代号");
ExcelSheet.OlePropertyGet("Cells",2,2).OlePropertySet("Value","姓名");
ExcelSheet.OlePropertyGet("Cells",2,3).OlePropertySet("Value","性别");
ExcelSheet.OlePropertyGet("Cells",2,4).OlePropertySet("Value","地址");
Row=3;
Query1->First();
//开始复制数据
//此处没有采异常捕捉了,呵呵,应该不会有错吧,反正我是没有碰到过
while(!Query1->Eof)
{
Id=Query1->FieldByName("id")->AsString;
Name=Query1->FieldByName("Name")->AsString;
Sex=Query1->FieldByName("Sex")->AsString;
Addr=Query1->FieldByName("Addr")->AsString;
//开始填充数据
ExcelSheet.OlePropertyGet("Cells",Row,1).OlePropertySet("Value",Id.c_str());
ExcelSheet.OlePropertyGet("Cells",Row,2).OlePropertySet("Value",Name.c_str());
ExcelSheet.OlePropertyGet("Cells",Row,3).OlePropertySet("Value",Sex.c_str());
ExcelSheet.OlePropertyGet("Cells",Row,4).OlePropertySet("Value",Addr.c_str());
Query1->Next();
++Row;
}
}
//---------------------------------------------------------------------------
以上文字如需转载,请保持完整性。风吹斜阳 共享,进步!
#35
如果有邮件,还是给我一份把!!谢谢
#36
谢谢!
#37
zengbao_1028@hotmail.com谢谢,谢谢我也需要,麻烦了!!!
#38
谢谢,我也想要一份
lushixue@263.net
lushixue@263.net
#39
谢谢,我也想要一份
l_y_p.263.net
l_y_p.263.net
#40
thanks!
hn_cs_rengang@21cn.com
hn_cs_rengang@21cn.com
#41
thanks!
wwj7575@163.com
wwj7575@163.com
#42
......
ExcelSheet.OlePropertyGet("Cells",1,1).OlePropertySet("Value","如果你见过这个信息的话,代表成功");
for (int i=0; i<DBGrid1->Columns->Count; i++)
ExcelSheet.OlePropertyGet("Cells",2,1).OlePropertySet("Value",
DBGrid1->Columns->Items[i]->Title->Caption);
// ExcelSheet.OlePropertyGet("Cells",2,1).OlePropertySet("Value","代号");
// ExcelSheet.OlePropertyGet("Cells",2,2).OlePropertySet("Value","姓名");
// ExcelSheet.OlePropertyGet("Cells",2,3).OlePropertySet("Value","性别");
// ExcelSheet.OlePropertyGet("Cells",2,4).OlePropertySet("Value","地址");
Row=3;
Query1->First();
......
没有最好,只有更好
ExcelSheet.OlePropertyGet("Cells",1,1).OlePropertySet("Value","如果你见过这个信息的话,代表成功");
for (int i=0; i<DBGrid1->Columns->Count; i++)
ExcelSheet.OlePropertyGet("Cells",2,1).OlePropertySet("Value",
DBGrid1->Columns->Items[i]->Title->Caption);
// ExcelSheet.OlePropertyGet("Cells",2,1).OlePropertySet("Value","代号");
// ExcelSheet.OlePropertyGet("Cells",2,2).OlePropertySet("Value","姓名");
// ExcelSheet.OlePropertyGet("Cells",2,3).OlePropertySet("Value","性别");
// ExcelSheet.OlePropertyGet("Cells",2,4).OlePropertySet("Value","地址");
Row=3;
Query1->First();
......
没有最好,只有更好
#43
同意
#44
怎么样复制一个Sheet到新建的sheet,help!,hifis@163.com
#45
怎么没人回答?火急
#46
copy as a new file and then open
#47
我使用ExcelApplication控件,还行,关键是要打升级补丁
#1
我自己做了一个从DBGridEh表格选择表格栏处理到excel的控件,并且可以生成打印fastreport报表,在fastreport打印时可以打印的页面设置要能选择纵向或横向,但没有做纸张选择A4/A3,只做了a4下的纵向或横向选择
若要给我留下email
若要给我留下email
#2
请楼上的兄弟也给我发一份!
liwei@tydic.com
先谢了!
liwei@tydic.com
先谢了!
#3
me too
ghiewa@etang.com
ghiewa@etang.com
#4
qkd@xinhuanet.com
#5
wayenlee@citiz.net
我也要,谢谢
我也要,谢谢
#6
cao_bf@163.com
我也要啊,谢谢了
我也要啊,谢谢了
#7
sydt@sina.com
我也要,谢谢!!!
我也要,谢谢!!!
#8
ratmove@tom.com谢谢,谢谢我也需要,麻烦了!!!
#9
andy_qhz@163.net thank you
#10
赫赫,谢谢了,兄弟!
lycloud1978@163.com
lycloud1978@163.com
#11
还要等到什么时候啊?快发吧。qkd@xinhuanet.com
#12
kvyd@163.com
多谢啦
abis.vicp.net
多谢啦
abis.vicp.net
#13
给我也发一份吧:lcj49997@yeah.net
#14
谢稿,能否也给你一份!
#15
send to all
#16
给我一份吧,谢谢!
xrf@vip.sina.com
xrf@vip.sina.com
#17
ok xrfei(相如飞)
#18
mrchenjinghong@163.com
给我一份谢谢
给我一份谢谢
#19
谢谢了,能给我发一份吗?
qiuqiu_xu123@163.com
qiuqiu_xu123@163.com
#20
谢谢了,能给我发一份吗?
isys@yeah.net
isys@yeah.net
#21
我在这里做慈善了,哈哈
#22
用F1Book控件啊
#23
我要一个
发给我吧
xhusa@163.com
发给我吧
xhusa@163.com
#24
我受到了,还不会用呢
#25
谢谢,lmj_hit@163.net
#26
呵呵!
#27
我怎么装不上啊,有装上的没有啊,请告诉小弟怎么安装啊。我装了FastReport还是装不上:
[C++ Error] report_dlgx.h(10): E2209 Unable to open include file 'DBGridEh.hpp'
[C++ Error] report_dlgx.h(66): E2303 Type name expected
。。。。。。。。。。。。。。
[C++ Error] report_dlgx.h(10): E2209 Unable to open include file 'DBGridEh.hpp'
[C++ Error] report_dlgx.h(66): E2303 Type name expected
。。。。。。。。。。。。。。
#28
to:houzy123(houzy123)
我也要一份
cptang@263.net
我也要一份
cptang@263.net
#29
lvjack@sohu.com
要的人这么多,老兄要不挂到chinabcb去然后给个链接
要的人这么多,老兄要不挂到chinabcb去然后给个链接
#30
我也要一份
yangjinhui2000@163.com
yangjinhui2000@163.com
#31
关注
#32
各位,此控件是fastreport下处理DBGridEh的打印问题,同时可以将其另存为excel,所以你要安装有DBGridEh方可使用,若要处理DBGrid表格,你可以修改原代码#include "DBGridEh.hpp"和DBGridEh的link并且修改TDBGridEh *myDBGridEh;为TDBGrid *myDBGridEh;
#33
发一分吧!
liuyong@sanycom.com
THX
liuyong@sanycom.com
THX
#34
以下是ChinaBcb.风吹斜阳 的解答,大家转贴的时候保持完整
========================================================================
在一次开发中,我应某些人的要求,要将数据库中的数据导出至EXCEL进一步处理,为了不想让自己成为某些人眼中的弱智职员。我答应了下来,谁知噩梦开始了……
开始我准备用BCB组件Office2k页中的ExcelApplication来控制Excel,我在实际开发中发现如果添加一些组件的话,程序根本编译不过,出现以下错误信息:
Build
[C++ Error] ComCtrls.hpp(2638): E2015 Ambiguity between 'Windows' and 'Excel_2k::Windows'
[C++ Error] ComCtrls.hpp(2839): E2015 Ambiguity between 'Windows' and 'Excel_2k::Windows'
[C++ Error] ComCtrls.hpp(3430): E2015 Ambiguity between 'Menus' and 'Excel_2k::Menus'
[C++ Error] ComCtrls.hpp(3431): E2015 Ambiguity between 'Menus' and 'Excel_2k::Menus'
[C++ Error] ComCtrls.hpp(3435): E2015 Ambiguity between 'Menus' and 'Excel_2k::Menus'
[C++ Error] ComCtrls.hpp(3477): E2015 Ambiguity between 'Menus' and 'Excel_2k::Menus'
[C++ Error] ComCtrls.hpp(3577): E2015 Ambiguity between 'Menus' and 'Excel_2k::Menus'
[C++ Error] ComCtrls.hpp(3640): E2015 Ambiguity between 'Menus' and 'Excel_2k::Menus'
[C++ Error] ComCtrls.hpp(3641): E2015 Ambiguity between 'Menus' and 'Excel_2k::Menus'
[C++ Error] ComCtrls.hpp(3652): E2015 Ambiguity between 'Menus' and 'Excel_2k::Menus'
[C++ Error] ComCtrls.hpp(3657): E2015 Ambiguity between 'Menus' and 'Excel_2k::Menus'
[C++ Error] ComCtrls.hpp(3699): E2015 Ambiguity between 'Menus' and 'Excel_2k::Menus'
[C++ Error] ComCtrls.hpp(3706): E2015 Ambiguity between 'Menus' and 'Excel_2k::Menus'
[C++ Error] ComCtrls.hpp(4140): E2015 Ambiguity between 'Windows' and 'Excel_2k::Windows'
[C++ Error] ComCtrls.hpp(4259): E2015 Ambiguity between 'Windows' and 'Excel_2k::Windows'
[C++ Error] ComCtrls.hpp(4429): E2015 Ambiguity between 'Windows' and 'Excel_2k::Windows'
[C++ Error] DBCtrls.hpp(1075): E2015 Ambiguity between 'Buttons' and 'Excel_2k::Buttons'
[C++ Error] DBCtrls.hpp(1077): E2015 Ambiguity between 'Buttons' and 'Excel_2k::Buttons'
[C++ Error] DBCtrls.hpp(1096): E2015 Ambiguity between 'Buttons' and 'Excel_2k::Buttons'
[C++ Error] DBGrids.hpp(62): E2015 Ambiguity between 'Menus' and 'Excel_2k::Menus'
[C++ Error] DBGrids.hpp(102): E2015 Ambiguity between 'Menus' and 'Excel_2k::Menus'
[C++ Error] DBGrids.hpp(148): E2015 Ambiguity between 'Menus' and 'Excel_2k::Menus'
真是太牛了,我开始以为是BCB秀逗了,重新安装都不行,我当时不知道为什么,到这篇文章出来的时候还是不知道。如果我知道是为什么,我会公布的。现在研究中。如果有那位大侠知道了,也请贴出来,在此谢过!
在没有解决这个问题之前,我曾经想哭,但我没有哭。哭并不是技术上的难题解决不了,而是…………,我真的不想再提起。幸好现在解决了,呵呵,我还不算在某些人眼中的弱智。
好了,不说废话了。下面正式进入话题。以下程序代码是在某些人要求编写的大型MIS系统中移植下来的,以下代码基于BDE。如果不知道怎么配置BDE,就找本书看吧。这里将不在废话了!
以下代码均在Widows 2000 Advance Server BCB6.0中编译通过!运行成功!开香槟吧!呵呵!
在BCB中新建一个Application,Application中用了以下一些控件:Query DataSource DBGrid Bitbtn。其主要属性设置如下:
Query1->SQL值为select * from Example,Query1的Active可以在窗体创建时设置,在这里我设为True,因为我的数据库才一条数据,*^-^*
DataSource->DataSource指向Query1
DBGrid1->DataSource 指向DataSource1
Bitbtn1找副好图片吧,Bitbtn2->Kind 为bkClose 我总得要退出是吧!呵呵。
数据库的结构:
Field name Type Size Key
Id A 5 *
Name A 8
Sex A 2
Addr A 20
结构有点乱,嗯,反正是示范数据库,没有实际价值。所以我没有再调整了,将就着用吧!
代码部分:
头文件代码:
//---------------------------------------------------------------------------
#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <DB.hpp>
#include <DBGrids.hpp>
#include <DBTables.hpp>
#include <Grids.hpp>
#include <Buttons.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published: // IDE-managed Components
TQuery *Query1;
TDataSource *DataSource1;
TDBGrid *DBGrid1;
TBitBtn *BitBtn1;
TBitBtn *BitBtn2;
void __fastcall BitBtn1Click(TObject *Sender);
private: // User declarations
public: // User declarations
__fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif
//CPP文件代码
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::BitBtn1Click(TObject *Sender)
{
Query1->Close();
Query1->Open();
if (Query1->IsEmpty()) //判断数据源是否有数据,如果没有数据还干什么,是吧!
{
MessageBox(Handle,"没有数据,我要退出了","错误",MB_OK|MB_ICONINFORMATION);
return;
}
Variant Excel;
Variant ExcelBook;
Variant ExcelSheet;
long Row;
AnsiString Id,Name,Sex,Addr;
try
{
//开始启动EXCEL
Excel=Variant::CreateObject("Excel.Application");
}
catch(...) //这样捕捉异常惯了,所以…………
{
//麻烦了,好像没有EXCEL程序
MessageBox(Handle,"不是吧,好像没有EXCEL耶,检查一下吧","错误",MB_OK|MB_ICONERROR);
return; //没有Excel我就走了
}
//此处的 true 为小写,注意
Excel.OlePropertySet("Visible",true);
ExcelBook=Excel.OlePropertyGet("workbooks");
ExcelSheet=ExcelBook.OleFunction("add");
ExcelBook=Excel.OlePropertyGet("ActiveWorkBook");
ExcelSheet=ExcelBook.OlePropertyGet("ActiveSheet");
ExcelSheet.OlePropertyGet("Cells",1,1).OlePropertySet("Value","如果你见过这个信息的话,代表成功");
ExcelSheet.OlePropertyGet("Cells",2,1).OlePropertySet("Value","代号");
ExcelSheet.OlePropertyGet("Cells",2,2).OlePropertySet("Value","姓名");
ExcelSheet.OlePropertyGet("Cells",2,3).OlePropertySet("Value","性别");
ExcelSheet.OlePropertyGet("Cells",2,4).OlePropertySet("Value","地址");
Row=3;
Query1->First();
//开始复制数据
//此处没有采异常捕捉了,呵呵,应该不会有错吧,反正我是没有碰到过
while(!Query1->Eof)
{
Id=Query1->FieldByName("id")->AsString;
Name=Query1->FieldByName("Name")->AsString;
Sex=Query1->FieldByName("Sex")->AsString;
Addr=Query1->FieldByName("Addr")->AsString;
//开始填充数据
ExcelSheet.OlePropertyGet("Cells",Row,1).OlePropertySet("Value",Id.c_str());
ExcelSheet.OlePropertyGet("Cells",Row,2).OlePropertySet("Value",Name.c_str());
ExcelSheet.OlePropertyGet("Cells",Row,3).OlePropertySet("Value",Sex.c_str());
ExcelSheet.OlePropertyGet("Cells",Row,4).OlePropertySet("Value",Addr.c_str());
Query1->Next();
++Row;
}
}
//---------------------------------------------------------------------------
以上文字如需转载,请保持完整性。风吹斜阳 共享,进步!
========================================================================
在一次开发中,我应某些人的要求,要将数据库中的数据导出至EXCEL进一步处理,为了不想让自己成为某些人眼中的弱智职员。我答应了下来,谁知噩梦开始了……
开始我准备用BCB组件Office2k页中的ExcelApplication来控制Excel,我在实际开发中发现如果添加一些组件的话,程序根本编译不过,出现以下错误信息:
Build
[C++ Error] ComCtrls.hpp(2638): E2015 Ambiguity between 'Windows' and 'Excel_2k::Windows'
[C++ Error] ComCtrls.hpp(2839): E2015 Ambiguity between 'Windows' and 'Excel_2k::Windows'
[C++ Error] ComCtrls.hpp(3430): E2015 Ambiguity between 'Menus' and 'Excel_2k::Menus'
[C++ Error] ComCtrls.hpp(3431): E2015 Ambiguity between 'Menus' and 'Excel_2k::Menus'
[C++ Error] ComCtrls.hpp(3435): E2015 Ambiguity between 'Menus' and 'Excel_2k::Menus'
[C++ Error] ComCtrls.hpp(3477): E2015 Ambiguity between 'Menus' and 'Excel_2k::Menus'
[C++ Error] ComCtrls.hpp(3577): E2015 Ambiguity between 'Menus' and 'Excel_2k::Menus'
[C++ Error] ComCtrls.hpp(3640): E2015 Ambiguity between 'Menus' and 'Excel_2k::Menus'
[C++ Error] ComCtrls.hpp(3641): E2015 Ambiguity between 'Menus' and 'Excel_2k::Menus'
[C++ Error] ComCtrls.hpp(3652): E2015 Ambiguity between 'Menus' and 'Excel_2k::Menus'
[C++ Error] ComCtrls.hpp(3657): E2015 Ambiguity between 'Menus' and 'Excel_2k::Menus'
[C++ Error] ComCtrls.hpp(3699): E2015 Ambiguity between 'Menus' and 'Excel_2k::Menus'
[C++ Error] ComCtrls.hpp(3706): E2015 Ambiguity between 'Menus' and 'Excel_2k::Menus'
[C++ Error] ComCtrls.hpp(4140): E2015 Ambiguity between 'Windows' and 'Excel_2k::Windows'
[C++ Error] ComCtrls.hpp(4259): E2015 Ambiguity between 'Windows' and 'Excel_2k::Windows'
[C++ Error] ComCtrls.hpp(4429): E2015 Ambiguity between 'Windows' and 'Excel_2k::Windows'
[C++ Error] DBCtrls.hpp(1075): E2015 Ambiguity between 'Buttons' and 'Excel_2k::Buttons'
[C++ Error] DBCtrls.hpp(1077): E2015 Ambiguity between 'Buttons' and 'Excel_2k::Buttons'
[C++ Error] DBCtrls.hpp(1096): E2015 Ambiguity between 'Buttons' and 'Excel_2k::Buttons'
[C++ Error] DBGrids.hpp(62): E2015 Ambiguity between 'Menus' and 'Excel_2k::Menus'
[C++ Error] DBGrids.hpp(102): E2015 Ambiguity between 'Menus' and 'Excel_2k::Menus'
[C++ Error] DBGrids.hpp(148): E2015 Ambiguity between 'Menus' and 'Excel_2k::Menus'
真是太牛了,我开始以为是BCB秀逗了,重新安装都不行,我当时不知道为什么,到这篇文章出来的时候还是不知道。如果我知道是为什么,我会公布的。现在研究中。如果有那位大侠知道了,也请贴出来,在此谢过!
在没有解决这个问题之前,我曾经想哭,但我没有哭。哭并不是技术上的难题解决不了,而是…………,我真的不想再提起。幸好现在解决了,呵呵,我还不算在某些人眼中的弱智。
好了,不说废话了。下面正式进入话题。以下程序代码是在某些人要求编写的大型MIS系统中移植下来的,以下代码基于BDE。如果不知道怎么配置BDE,就找本书看吧。这里将不在废话了!
以下代码均在Widows 2000 Advance Server BCB6.0中编译通过!运行成功!开香槟吧!呵呵!
在BCB中新建一个Application,Application中用了以下一些控件:Query DataSource DBGrid Bitbtn。其主要属性设置如下:
Query1->SQL值为select * from Example,Query1的Active可以在窗体创建时设置,在这里我设为True,因为我的数据库才一条数据,*^-^*
DataSource->DataSource指向Query1
DBGrid1->DataSource 指向DataSource1
Bitbtn1找副好图片吧,Bitbtn2->Kind 为bkClose 我总得要退出是吧!呵呵。
数据库的结构:
Field name Type Size Key
Id A 5 *
Name A 8
Sex A 2
Addr A 20
结构有点乱,嗯,反正是示范数据库,没有实际价值。所以我没有再调整了,将就着用吧!
代码部分:
头文件代码:
//---------------------------------------------------------------------------
#ifndef Unit1H
#define Unit1H
//---------------------------------------------------------------------------
#include <Classes.hpp>
#include <Controls.hpp>
#include <StdCtrls.hpp>
#include <Forms.hpp>
#include <DB.hpp>
#include <DBGrids.hpp>
#include <DBTables.hpp>
#include <Grids.hpp>
#include <Buttons.hpp>
//---------------------------------------------------------------------------
class TForm1 : public TForm
{
__published: // IDE-managed Components
TQuery *Query1;
TDataSource *DataSource1;
TDBGrid *DBGrid1;
TBitBtn *BitBtn1;
TBitBtn *BitBtn2;
void __fastcall BitBtn1Click(TObject *Sender);
private: // User declarations
public: // User declarations
__fastcall TForm1(TComponent* Owner);
};
//---------------------------------------------------------------------------
extern PACKAGE TForm1 *Form1;
//---------------------------------------------------------------------------
#endif
//CPP文件代码
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::BitBtn1Click(TObject *Sender)
{
Query1->Close();
Query1->Open();
if (Query1->IsEmpty()) //判断数据源是否有数据,如果没有数据还干什么,是吧!
{
MessageBox(Handle,"没有数据,我要退出了","错误",MB_OK|MB_ICONINFORMATION);
return;
}
Variant Excel;
Variant ExcelBook;
Variant ExcelSheet;
long Row;
AnsiString Id,Name,Sex,Addr;
try
{
//开始启动EXCEL
Excel=Variant::CreateObject("Excel.Application");
}
catch(...) //这样捕捉异常惯了,所以…………
{
//麻烦了,好像没有EXCEL程序
MessageBox(Handle,"不是吧,好像没有EXCEL耶,检查一下吧","错误",MB_OK|MB_ICONERROR);
return; //没有Excel我就走了
}
//此处的 true 为小写,注意
Excel.OlePropertySet("Visible",true);
ExcelBook=Excel.OlePropertyGet("workbooks");
ExcelSheet=ExcelBook.OleFunction("add");
ExcelBook=Excel.OlePropertyGet("ActiveWorkBook");
ExcelSheet=ExcelBook.OlePropertyGet("ActiveSheet");
ExcelSheet.OlePropertyGet("Cells",1,1).OlePropertySet("Value","如果你见过这个信息的话,代表成功");
ExcelSheet.OlePropertyGet("Cells",2,1).OlePropertySet("Value","代号");
ExcelSheet.OlePropertyGet("Cells",2,2).OlePropertySet("Value","姓名");
ExcelSheet.OlePropertyGet("Cells",2,3).OlePropertySet("Value","性别");
ExcelSheet.OlePropertyGet("Cells",2,4).OlePropertySet("Value","地址");
Row=3;
Query1->First();
//开始复制数据
//此处没有采异常捕捉了,呵呵,应该不会有错吧,反正我是没有碰到过
while(!Query1->Eof)
{
Id=Query1->FieldByName("id")->AsString;
Name=Query1->FieldByName("Name")->AsString;
Sex=Query1->FieldByName("Sex")->AsString;
Addr=Query1->FieldByName("Addr")->AsString;
//开始填充数据
ExcelSheet.OlePropertyGet("Cells",Row,1).OlePropertySet("Value",Id.c_str());
ExcelSheet.OlePropertyGet("Cells",Row,2).OlePropertySet("Value",Name.c_str());
ExcelSheet.OlePropertyGet("Cells",Row,3).OlePropertySet("Value",Sex.c_str());
ExcelSheet.OlePropertyGet("Cells",Row,4).OlePropertySet("Value",Addr.c_str());
Query1->Next();
++Row;
}
}
//---------------------------------------------------------------------------
以上文字如需转载,请保持完整性。风吹斜阳 共享,进步!
#35
如果有邮件,还是给我一份把!!谢谢
#36
谢谢!
#37
zengbao_1028@hotmail.com谢谢,谢谢我也需要,麻烦了!!!
#38
谢谢,我也想要一份
lushixue@263.net
lushixue@263.net
#39
谢谢,我也想要一份
l_y_p.263.net
l_y_p.263.net
#40
thanks!
hn_cs_rengang@21cn.com
hn_cs_rengang@21cn.com
#41
thanks!
wwj7575@163.com
wwj7575@163.com
#42
......
ExcelSheet.OlePropertyGet("Cells",1,1).OlePropertySet("Value","如果你见过这个信息的话,代表成功");
for (int i=0; i<DBGrid1->Columns->Count; i++)
ExcelSheet.OlePropertyGet("Cells",2,1).OlePropertySet("Value",
DBGrid1->Columns->Items[i]->Title->Caption);
// ExcelSheet.OlePropertyGet("Cells",2,1).OlePropertySet("Value","代号");
// ExcelSheet.OlePropertyGet("Cells",2,2).OlePropertySet("Value","姓名");
// ExcelSheet.OlePropertyGet("Cells",2,3).OlePropertySet("Value","性别");
// ExcelSheet.OlePropertyGet("Cells",2,4).OlePropertySet("Value","地址");
Row=3;
Query1->First();
......
没有最好,只有更好
ExcelSheet.OlePropertyGet("Cells",1,1).OlePropertySet("Value","如果你见过这个信息的话,代表成功");
for (int i=0; i<DBGrid1->Columns->Count; i++)
ExcelSheet.OlePropertyGet("Cells",2,1).OlePropertySet("Value",
DBGrid1->Columns->Items[i]->Title->Caption);
// ExcelSheet.OlePropertyGet("Cells",2,1).OlePropertySet("Value","代号");
// ExcelSheet.OlePropertyGet("Cells",2,2).OlePropertySet("Value","姓名");
// ExcelSheet.OlePropertyGet("Cells",2,3).OlePropertySet("Value","性别");
// ExcelSheet.OlePropertyGet("Cells",2,4).OlePropertySet("Value","地址");
Row=3;
Query1->First();
......
没有最好,只有更好
#43
同意
#44
怎么样复制一个Sheet到新建的sheet,help!,hifis@163.com
#45
怎么没人回答?火急
#46
copy as a new file and then open
#47
我使用ExcelApplication控件,还行,关键是要打升级补丁