delphi里面怎么打印? 一个stringgrid,有滚动条,窗口上只能显示一部分数据想把整个表的数据打印出来,该怎么处理?能否整个表格作为一个整体打印?(stringgrid类好像没有print方法) 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 要么自己写,要么用QuickRep控件,要么第三方 数据库里有和stringgrid中数据结构相同下表吗,有直接用表相连在quickrep中实现;没有就用临时表把stringgrid中的数据存进去,再在stringgrid中实现。 当年用BCB写的,看看void TFQuickRep::ShowForm(TStringGrid* StringGrid){ TList *ShapeList ; TList *ShapeList2 ; TList *LabelList ; TList *QRTextList ; TQRShape *NewShape ; TQRShape *OneShape ; TQRLabel *NewLabel ; TQRDBText *NewQRText; int iTemp1,iTemp2 ; AnsiString sSQL; ShapeList = new TList ; ShapeList2 = new TList; LabelList = new TList ; QRTextList = new TList; QRTitleShape->Width = StringGrid->ColWidths[0] ; QRDetailShape->Width = StringGrid->ColWidths[0]; QRTitleLabel->Caption = StringGrid->Cells[0][0]; for(int m=0;m<StringGrid->FixedRows;m++) { ShapeList->Clear(); LabelList->Clear(); LabelList->Add(QRTitleLabel) ; ShapeList->Add(QRTitleShape) ; if(m>0) { QRBand1->Height = QRBand1->Height+QRTitleShape->Height; NewShape = new TQRShape(this); NewShape->Parent = QRBand1; NewShape->Height = QRTitleShape->Height; NewShape->Width = StringGrid->ColWidths[0]; NewShape->Left = QRTitleShape->Left; NewShape->Top=QRTitleShape->Top+m*(NewShape->Height); NewLabel = new TQRLabel(this); NewLabel->Parent = QRBand1; NewLabel->Caption = StringGrid->Cells[0][m]; NewLabel->Left = iTemp1+5; NewLabel->Top=NewShape->Top + 3; NewLabel->AutoSize = true; NewLabel->BringToFront(); } for(int i=1;i<StringGrid->ColCount;i++) { iTemp1 = QRTitleShape->Left; NewShape = new TQRShape(this); NewShape->Parent = QRBand1; NewShape->Height = QRTitleShape->Height; NewShape->Width = StringGrid->ColWidths[i]; for(int j=0;j<ShapeList->Count;j++) { iTemp1 = iTemp1+((TQRShape *)(ShapeList->Items[j]))->Width-1; } NewShape->Left = iTemp1; NewShape->Top=QRTitleShape->Top+m*(NewShape->Height); ShapeList->Add(NewShape); NewLabel = new TQRLabel(this); NewLabel->Parent = QRBand1; NewLabel->Caption = StringGrid->Cells[i][m]; NewLabel->Left = iTemp1+5; NewLabel->Top=NewShape->Top + 3; NewLabel->AutoSize = true; NewLabel->BringToFront(); } } ShapeList2->Add(QRDetailShape); QRTextList->Add(QRDBDetailText); for(int i=1;i<StringGrid->ColCount;i++) { iTemp1 = QRDetailShape->Left; OneShape = new TQRShape(this); OneShape->Parent = QRBand2; OneShape->Height = QRDetailShape->Height; OneShape->Width = StringGrid->ColWidths[i]; for(int j=0;j<ShapeList2->Count;j++) { iTemp1 = iTemp1+((TQRShape *)(ShapeList2->Items[j]))->Width-1; } OneShape->Left = iTemp1; OneShape->Top=QRDetailShape->Top; ShapeList2->Add(OneShape); NewQRText = new TQRDBText(this); NewQRText->Parent = QRBand2; NewQRText->Left = iTemp1+5; NewQRText->Top=QRDBDetailText->Top; NewQRText->AutoSize = true; NewQRText->BringToFront(); QRTextList->Add(NewQRText); } sSQL = "select * from tReport_tmp"; if(OpenSQL(DMMain->qryCall,sSQL)) { for(int i=0;i<QRTextList->Count;i++) { ((TQRDBText *)(QRTextList->Items[i]))->DataSet=DMMain->qryCall; ((TQRDBText *)(QRTextList->Items[i]))->DataField="F"+IntToStr(i); } } QuickRep1->Preview();} 跟数据库没有关系,就是一个stringgrid控件显示一些数据不是数据库的表 DLL中的ShareMem问题 应用程序怎样获取快捷方式运行时带有的参数 通过SOCKET来通讯时,来访问主线程自己编写的非可视控件时需要 高手指教:推荐一下3D引擎、建模工具,一定要有例子! DBGrid和DataSource的问题 哪位大虾帮我看看这段代码? 高分求教,如何对有对应关系的三个表中的数据进行操作?急...急... 我想去北京发展,哪位好心人给我指引? 关于var 变量,各位大虾请进,必定送分 各位,那里有DELPHI原码 ADO的动态连接————在线等待哟!!! 这个控件有什么用?
没有就用临时表把stringgrid中的数据存进去,再在stringgrid中实现。
void TFQuickRep::ShowForm(TStringGrid* StringGrid)
{
TList *ShapeList ;
TList *ShapeList2 ;
TList *LabelList ;
TList *QRTextList ;
TQRShape *NewShape ;
TQRShape *OneShape ;
TQRLabel *NewLabel ;
TQRDBText *NewQRText;
int iTemp1,iTemp2 ;
AnsiString sSQL; ShapeList = new TList ;
ShapeList2 = new TList;
LabelList = new TList ;
QRTextList = new TList; QRTitleShape->Width = StringGrid->ColWidths[0] ;
QRDetailShape->Width = StringGrid->ColWidths[0];
QRTitleLabel->Caption = StringGrid->Cells[0][0]; for(int m=0;m<StringGrid->FixedRows;m++)
{
ShapeList->Clear();
LabelList->Clear();
LabelList->Add(QRTitleLabel) ;
ShapeList->Add(QRTitleShape) ;
if(m>0)
{
QRBand1->Height = QRBand1->Height+QRTitleShape->Height;
NewShape = new TQRShape(this);
NewShape->Parent = QRBand1;
NewShape->Height = QRTitleShape->Height;
NewShape->Width = StringGrid->ColWidths[0]; NewShape->Left = QRTitleShape->Left;
NewShape->Top=QRTitleShape->Top+m*(NewShape->Height);
NewLabel = new TQRLabel(this);
NewLabel->Parent = QRBand1;
NewLabel->Caption = StringGrid->Cells[0][m];
NewLabel->Left = iTemp1+5;
NewLabel->Top=NewShape->Top + 3;
NewLabel->AutoSize = true;
NewLabel->BringToFront();
}
for(int i=1;i<StringGrid->ColCount;i++)
{ iTemp1 = QRTitleShape->Left;
NewShape = new TQRShape(this);
NewShape->Parent = QRBand1;
NewShape->Height = QRTitleShape->Height;
NewShape->Width = StringGrid->ColWidths[i];
for(int j=0;j<ShapeList->Count;j++)
{
iTemp1 = iTemp1+((TQRShape *)(ShapeList->Items[j]))->Width-1;
}
NewShape->Left = iTemp1;
NewShape->Top=QRTitleShape->Top+m*(NewShape->Height);
ShapeList->Add(NewShape); NewLabel = new TQRLabel(this);
NewLabel->Parent = QRBand1;
NewLabel->Caption = StringGrid->Cells[i][m];
NewLabel->Left = iTemp1+5;
NewLabel->Top=NewShape->Top + 3;
NewLabel->AutoSize = true;
NewLabel->BringToFront();
}
} ShapeList2->Add(QRDetailShape);
QRTextList->Add(QRDBDetailText);
for(int i=1;i<StringGrid->ColCount;i++)
{
iTemp1 = QRDetailShape->Left;
OneShape = new TQRShape(this);
OneShape->Parent = QRBand2;
OneShape->Height = QRDetailShape->Height;
OneShape->Width = StringGrid->ColWidths[i];
for(int j=0;j<ShapeList2->Count;j++)
{
iTemp1 = iTemp1+((TQRShape *)(ShapeList2->Items[j]))->Width-1;
}
OneShape->Left = iTemp1;
OneShape->Top=QRDetailShape->Top;
ShapeList2->Add(OneShape); NewQRText = new TQRDBText(this);
NewQRText->Parent = QRBand2;
NewQRText->Left = iTemp1+5;
NewQRText->Top=QRDBDetailText->Top;
NewQRText->AutoSize = true;
NewQRText->BringToFront();
QRTextList->Add(NewQRText);
}
sSQL = "select * from tReport_tmp";
if(OpenSQL(DMMain->qryCall,sSQL))
{
for(int i=0;i<QRTextList->Count;i++)
{
((TQRDBText *)(QRTextList->Items[i]))->DataSet=DMMain->qryCall;
((TQRDBText *)(QRTextList->Items[i]))->DataField="F"+IntToStr(i);
}
}
QuickRep1->Preview();
}
不是数据库的表