Bonjour,
J'ai un probl�me avec l'impression de deux StringGrid sur QReport : je n'obtiens pas le r�sultat souhait�. De plus, je n'ai pas bien compris l'utilisation de la propri�t� BandType de QRBand (rbTitle, rbSummary, etc.). Du coup, je ne parviens pas � afficher les titres des champs de la 1re StringGrid, puis son contenu, ensuite les titres des champs de la 2e StringGrid et enfin son contenu. Voici le r�sultat recherch� :
Sur Form1, j'ai deux StringGrid et un bouton pour lancer l'impression. Et sur Form2, j'ai un QReport sur lequel j'ai mis deux QRBand. QRBand1 contient deux QRLabel et QRBand2 en contient trois.
Code : S�lectionner tout - Visualiser dans une fen�tre � part
1
2
3
4
5
6
7
8 Nom Pr�nom Alain Dupont Fabrice Dollet Num�ro CP Pays 778 98000 Pays1 879 75432 Pays2 654 56897 Pays3
Voici le code que j'utilise :
Je vous remercie d'avance pour votre aide.
Code C++ : S�lectionner tout - Visualiser dans une fen�tre � part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32 bool TForm1::Reporter() { if (index > Form1->StringGrid1->RowCount && index > Form1->StringGrid2->RowCount) { index = 1; return false; } else { if (index <= Form1->StringGrid1->RowCount) { Form2->QRLabel1->Caption = Form1->StringGrid1->Cells[0][index]; Form2->QRLabel2->Caption = Form1->StringGrid1->Cells[1][index]; } if (index <= Form1->StringGrid2->RowCount) { Form2->QRLabel3->Caption = Form1->StringGrid2->Cells[0][index]; Form2->QRLabel4->Caption = Form1->StringGrid2->Cells[1][index]; Form2->QRLabel5->Caption = Form1->StringGrid2->Cells[2][index]; } index++; return true; } } void __fastcall TForm2::QuickRep1NeedData(TObject *Sender, bool &MoreData) { MoreData = Form1->Reporter(); }
Partager