Essa é uma revisão anterior do documento!
Formatador de Relatório - ReportBuilder (Resumo do guia do desenvolvedor)
TUTORIAL DE RELATÓRIOS - B - C
1. Click in the white space of the group header band. The band should be selected in the Object Inspector.
2. Click on the Events tab of the Object Inspector and double-click on the BeforeGenerate event. Add the code shown below to the event handler.
Note: This routine retrieves the value of the recommendation field into a local string variable. It then assigns a color based on the value of the field. The color is stored in a private variable of the form so that all of the report event handlers can use it. The recommendation label in the group header band is set to the color. Finally, the recommendation label caption is set using the FirstPage property of the group. If FirstPage is False, then the group has overflowed onto an additional page.
1. Clique no espaço em branco da banda cabeçalho do grupo. A banda deve ser selecionado no Object Inspector.
2. Clique na guia Eventos do Inspetor de objetos e clique duas vezes sobre o evento BeforeGenerate. Adicione o código mostrado abaixo para o manipulador de eventos.
Nota: Esta rotina recupera o valor do campo de recomendação para uma cadeia variável local. Em seguida, atribui uma cor com base no valor do campo. A cor é armazenada em uma variável privada do formulário de modo que todos os manipuladores de eventos de relatórios podem usá-lo. O rótulo recomendação na banda cabeçalho do grupo está definido para a cor. Por fim, a legenda do rótulo recomendação é definido utilizando a propriedade FirstPage do grupo. Se FirstPage é falsa, então o grupo tem transbordou uma página adicional.
3. Scroll up in the Code Editor and add the following code to the 'private' section of the form class declaration:
3. Pressione para cima no Editor de código e adicione o seguinte código para a secção “privado” da declaração de classe do formulário:
FRecommendationColor: TColor;
4. Select View | Toggle Form/Unit from the Delphi main menu.
5. Select the Standard tab of the Delphi Component palette.
6. Create a button on the form.
7. Configure the button:
Name btnPreview Caption Preview
8. Add the following code to the OnClick event for the button:
8. Adicione o seguinte código para o evento OnClick do botão:
rbStock.Print;
9. Select File | Save from the Delphi main menu.
10. Run the project. The report should look like this:
10. Executar o projeto. O relatório deve ser semelhante a este: