Club Builder - Foros de discusión Club Builder
Foro de C++Builder en español
 
 FAQFAQ   BuscarBuscar   MiembrosMiembros   Grupos de UsuariosGrupos de Usuarios   RegistrarseRegistrarse 
 PerfilPerfil   Entra para ver tus mensajes privadosEntra para ver tus mensajes privados   EntrarEntrar 

Error en generacion de reporte dinamico de Leo

 
Publicar nuevo tema   Responder al tema    Foros de discusión -> Consultas
Ver tema anterior :: Ver tema siguiente  
Autor Mensaje
Mensaje    Asunto: Error en generacion de reporte dinamico de Leo Responder citando

Buenas todos!!

Estoy utilizando la función que colgó LEO para generar reportes (informes QuickReport) automáticos, y unas veces me funciona bien y otras no.
Me explico: resulta que el error consiste en que hay veces que cuando va por la mitad de la página o menos imprimiendo, deja un hueco en blanco hasta el final de la página y luego continua en otra nueva página, cuando debería hacerlo todo seguido.

Si alguien sabe cual puede ser el problema. Gracias!
Volver arriba
Ver perfil de usuario Enviar mensaje privado Enviar email MSN Messenger
Mensaje    Asunto: Responder citando

Supongo que te refieres a la de este enlace ?

https://cppbuilder.es/viewtopic.php?p=25866#25866

Si es así cual utilizas ? la que usa el TQRDBText ? o TQRExpr ? Si has hecho modificaciones sería interesante que la postearas aquí.

Te sucede con cualquier tabla ? o con algunas en concreto ? al seleccionar algún tipo de campo en particular ? Que versión de C++Builder y QuickReport utilizas y con que componentes de base de datos ?

Cualquier detalle que se te ocurra para poder reproducir el fallo..
Volver arriba
Ver perfil de usuario Enviar mensaje privado
Mensaje    Asunto: Responder citando

Hola Leo! y gracias por contestar.

--Efectivamente me refiero a esa rutina, y concretamente a la del TQRDBText, en la que he hecho algunas modificaciones en la función, pues yo no le paso un stringlist con los campos, sino que le paso un TDataSet para coger los campos del dbgrid q estan visibles.

-- Por lo que he observado, creo que tiene que ver por el campo que se ordena, si es numérico no hay problemas, sin embar si es de tipo texto y tiene algun caracter en blanco al principio se le va la pinza.

--Aqui te pongo la función por si ves algo raro:

void __fastcall TfrmPrincipal::GenerarMiInforme(TDataSet* dataset, TDBGrid *grid, AnsiString titulo1, AnsiString titulo2)
{
TStringList* campos = new TStringList;

if(dataset->IsEmpty())
return;
if(dataset->RecordCount==0)
return;

//CON ESTA FUNCION LO QUE HAGO ES GENERAR UN INFORME/LISTADO DE LA INFORMACIÓN QUE MUESTRO
//EN EL dbGRID

if(grid!=NULL) // PARA CUANDO EL DBGRID LLEVA CAMPOS LOOKUP-LISTAS DESPLEGABLES
{
for(int i = 0; i <grid>Columns->Count; i ++)
{
if(i>=grid->Columns->Count)
continue;
if(!grid->Columns->Items[i]->Visible)
continue;

try{
campos->Append(grid->Columns->Items[i]->FieldName);
}
catch(...)
{
continue;
}

}
}
else
{
//PONEMOS LOS TITULOS DE LAS COLUMNAS
for(int i=0; i <dataset>FieldDefs->Count ; i++)
{
try{
if(dataset->FieldByName(dataset->FieldDefs->Items[i]->Name)->Visible==false)
continue;
campos->Append(dataset->FieldDefs->Items[i]->Name);
}
catch(...)
{
continue;
}
}
}

if (campos->Count <1>DisableControls();

qr = new TQuickRep(Application);
qr->DataSet = dataset;
qr->Name = "QR" + String(Time().FormatString("hhmmss"));
AnsiString sTemp=Time();
sTemp=ReemplazaTexto(sTemp,":","");
qr->Name="QR" + sTemp;

TQRBand* bandPageHeader = qr->CreateBand(rbPageHeader);
TQRBand* bandPageFooter = qr->CreateBand(rbPageFooter);
TQRBand* bandColumnHeader = qr->CreateBand(rbColumnHeader);
TQRBand* bandDetail = qr->CreateBand(rbDetail);

qr->Units = MM;
qr->Page->LeftMargin=5;
qr->Page->RightMargin=5;
qr->BeforePrint=MiBeforePrintReport;

bandPageHeader->Size->Height = 15;
bandPageHeader->Frame->Color = clBlack;
bandPageHeader->Frame->Width = 2;
bandPageHeader->Frame->DrawTop = true;
bandPageHeader->Frame->DrawBottom = true;
bandPageHeader->Frame->DrawLeft = true;
bandPageHeader->Frame->DrawRight = true;

TQRLabel *QRLabelTitu;
QRLabelTitu = new TQRLabel(bandPageHeader);
QRLabelTitu->Parent = bandPageHeader;
QRLabelTitu->BringToFront();
QRLabelTitu->Left = 15;
QRLabelTitu->Top = 10;
QRLabelTitu->Caption = titulo1;
QRLabelTitu->Alignment = taLeftJustify;
QRLabelTitu->Font->Style = QRLabelTitu->Font->Style <<fsBold>Font->Name = "MS Sans Serif";
QRLabelTitu->AutoSize = false;
QRLabelTitu->Transparent = true;

TQRLabel *QRLabelTitu2;
QRLabelTitu2 = new TQRLabel(bandPageHeader);
QRLabelTitu2->Parent = bandPageHeader;
QRLabelTitu2->BringToFront();
QRLabelTitu2->Left = 15;
QRLabelTitu2->Top = 30;
QRLabelTitu2->Font->Size=6;
QRLabelTitu2->Transparent = true;
QRLabelTitu2->Caption = titulo2;
QRLabelTitu2->Alignment = taLeftJustify;
QRLabelTitu2->WordWrap = true;


bandPageFooter->Size->Height = 5;
bandPageFooter->Frame->DrawTop = true;
bandPageFooter->Frame->Color = clBlack;
bandPageFooter->Frame->Width = 2;

bandColumnHeader->Color = clSilver;
bandColumnHeader->Size->Height = 8;

TQRSysData* QRSysData = new TQRSysData(bandPageHeader);
/*QRSysData->Parent = bandPageHeader;
QRSysData->Data = qrsReportTitle;
QRSysData->AlignToBand = true;
QRSysData->Alignment = taLeftJustify;
QRSysData->Font->Style = TFontStyles() <<fsBold>Top += 10; */

QRSysData = new TQRSysData(bandPageFooter);
QRSysData->Parent = bandPageFooter;
QRSysData->Data = qrsPageNumber;
QRSysData->AlignToBand = true;
QRSysData->Alignment = taRightJustify;

// sTemp= qr->QRPrinter->PageNumber;
// sTemp=sTemp + "/" + qr->QRPrinter->PageCount;
QRSysData->Text = "Página ";
QRSysData->Top += 4;

// Calcula el alto y el ancho medio de una letra
TForm* mainForm = Application->MainForm;
mainForm->Font->Name="Arial";
mainForm->Font->Size=8;
mainForm->Canvas->Font->Assign(bandDetail->Font);
int charWidth = mainForm->Canvas->TextWidth("x");
int charHeight = mainForm->Canvas->TextHeight("Xg");
mainForm->Canvas->Font->Assign(mainForm->Font);

bandDetail->Font=mainForm->Font;
bandPageHeader->Font=mainForm->Font;
bandColumnHeader->Font=mainForm->Font;

// Definimos la altura de las bandas de cabecera y detalle
bandColumnHeader->Height = charHeight*2;
bandDetail->Height = charHeight + 2;

// Añade el texto
TQRLabel *QRLabel;
TQRDBText *QRDBText;
int pos = 0;


for (int i=0; i<campos>Count; i++)
{
String fieldName = campos->Strings[i];
AnsiString sDisplayLabel,sTextoEti=fieldName;
sTextoEti=ReemplazaTexto(sTextoEti," ","\r\n" );
TField* field = qr->DataSet->Fields->FieldByName(fieldName);
sDisplayLabel = qr->DataSet->Fields->FieldByName(fieldName)->DisplayLabel;

QRLabel = new TQRLabel(bandColumnHeader);
QRLabel->Parent = bandColumnHeader;
QRLabel->BringToFront();
QRLabel->AutoSize = false;
QRLabel->Transparent = true;
QRLabel->WordWrap=true;
QRLabel->Height=bandColumnHeader->Height;
//QRLabel->Caption = sTextoEti;
QRLabel->Caption = sDisplayLabel;

sTemp = "lbl" + fieldName;
QRLabel->Name=ReemplazaTexto(sTemp," ", "");

//if(field->DisplayWidth>255)
//field->DisplayWidth = 30;
QRLabel->Width = field->DisplayWidth * charWidth;
QRLabel->Left = pos;
QRLabel->Top = 2;

QRDBText = new TQRDBText(bandDetail);
QRDBText->Parent = bandDetail;
QRDBText->BringToFront();

sTemp = "QRDBText" + fieldName;
QRDBText->Name=ReemplazaTexto(sTemp," ", "");

QRDBText->AutoSize = false;
QRDBText->Color = bandDetail->Color;
QRDBText->Left = pos;
QRDBText->Top = 2;
QRDBText->Width = QRLabel->Width;
QRDBText->DataSet = dataset;
QRDBText->DataField = fieldName;

// Justificar a la derecha si es un campo numerico
//try{
if(dataset->FieldByName(fieldName)->DataType==ftFloat ||
dataset->FieldByName(fieldName)->DataType==ftSmallint ||
dataset->FieldByName(fieldName)->DataType==ftInteger)
{
QRLabel->Alignment = taRightJustify;
QRDBText->Alignment = taRightJustify;
if(QRLabel->Caption.AnsiPos("_") >0 )
{
bandDetail->Font->Size=6;
bandColumnHeader->Font->Size=6;
field->DisplayWidth =4;
}
else
{
if(QRLabel->Caption.AnsiPos("\r\n"))
field->DisplayWidth = 20;
else if(QRLabel->Caption.AnsiPos("INTERVENCION") )
field->DisplayWidth = 25;
else if(QRLabel->Caption.AnsiPos("ENERO") ||
QRLabel->Caption.AnsiPos("FEBRERO") ||
QRLabel->Caption.AnsiPos("MARZO") ||
QRLabel->Caption.AnsiPos("ABRIL") ||
QRLabel->Caption.AnsiPos("MAYO") ||
QRLabel->Caption.AnsiPos("JUNIO") ||
QRLabel->Caption.AnsiPos("JULIO") ||
QRLabel->Caption.AnsiPos("AGOSTO") ||
QRLabel->Caption.AnsiPos("SEPTIEMBRE") ||
QRLabel->Caption.AnsiPos("OCTUBRE") ||
QRLabel->Caption.AnsiPos("NOVIEMBRE") ||
QRLabel->Caption.AnsiPos("DICIEMBRE") )
field->DisplayWidth = 8;
else if(QRLabel->Caption.AnsiPos("Núm") ||
QRLabel->Caption.AnsiPos("Metro") )
field->DisplayWidth = 7;
else if(QRLabel->Caption=="CP")
field->DisplayWidth = 6;
else
field->DisplayWidth = 12;
}
QRLabel->Width = field->DisplayWidth * charWidth;
QRDBText->Width = QRLabel->Width;
}
//catch(...)
else
{
if(QRLabel->Caption.AnsiPos("SERVICIO") )
field->DisplayWidth = 25;
else if(QRLabel->Caption.AnsiPos("AGENTE") )
field->DisplayWidth = 40;
else if(QRLabel->Caption.AnsiPos("Núm. ") ||
QRLabel->Caption.AnsiPos("Provincia") ||
QRLabel->Caption.AnsiPos("Metro") )
field->DisplayWidth = 8;
else if(QRLabel->Caption.AnsiPos("Nº") ||
QRLabel->Caption.AnsiPos("PISO") ||
QRLabel->Caption.AnsiPos("Piso") ||
QRLabel->Caption.AnsiPos("Núm.") ||
QRLabel->Caption.AnsiPos("Puerta") ||
QRLabel->Caption.AnsiPos("LETRA") )
field->DisplayWidth = 4;
else if(QRLabel->Caption.AnsiPos("Fec") ||
QRLabel->Caption.AnsiPos("Sigla") ||
QRLabel->Caption.AnsiPos("FEC") ||
QRLabel->Caption.AnsiPos("HORA") ||
QRLabel->Caption.AnsiPos("DNI") ||
QRLabel->Caption.AnsiPos("Tfno") ||
QRLabel->Caption.AnsiPos("RET"))
field->DisplayWidth = 8;
else if(QRLabel->Caption.AnsiPos("Municipio") ||
QRLabel->Caption.AnsiPos("BASTIDOR") ||
QRLabel->Caption.AnsiPos("Actividad") )
field->DisplayWidth = 12;
else if(QRLabel->Caption.AnsiPos("TFNO") ||
QRLabel->Caption.AnsiPos("FAX"))
field->DisplayWidth = 12;
else if(QRLabel->Caption.AnsiPos("Padre") ||
QRLabel->Caption.AnsiPos("Madre"))
field->DisplayWidth = 6;
else if(QRLabel->Caption.AnsiPos("Direcci") ||
QRLabel->Caption.AnsiPos("DOMI") ||
QRLabel->Caption.AnsiPos("Mercader"))
field->DisplayWidth = 20;
else if(QRLabel->Caption.AnsiPos("Nombre"))
field->DisplayWidth = 15;
else if(QRLabel->Caption.AnsiPos("Apell") ||
QRLabel->Caption.AnsiPos("Nacionalidad"))
field->DisplayWidth = 10;
else if(QRLabel->Caption.AnsiPos("MATRÍCULA") ||
(QRLabel->Caption.AnsiPos("Num.") && QRLabel->Caption.AnsiPos("Docu.") )||
QRLabel->Caption.AnsiPos("TIPO") ||
QRLabel->Caption.AnsiPos("COLOR") ||
QRLabel->Caption.AnsiPos("MODELO") ||
QRLabel->Caption.AnsiPos("MARCA"))
field->DisplayWidth = 10;
else
field->DisplayWidth = 30;
QRLabel->Width = field->DisplayWidth * charWidth;
QRDBText->Width = QRLabel->Width;
}

pos += QRLabel->Width + QRLabel->Font->Size;
}

// Cambia la orientación del papel dependiendo del ancho del texto
if (pos <bandDetail>Width)
qr->Page->Orientation = poPortrait;
else
qr->Page->Orientation = poLandscape;

qr->ReportTitle = titulo2;

// Mostramos el report
qr->Prepare();
qr->Preview();
delete campos;

dataset->EnableControls();
dataset->First();
}
Volver arriba
Ver perfil de usuario Enviar mensaje privado Enviar email MSN Messenger
Mensaje    Asunto: Responder citando

Se me olvidaba, utilizo Uso Qreport en BCB4 con el parche.
Volver arriba
Ver perfil de usuario Enviar mensaje privado Enviar email MSN Messenger
Mensaje    Asunto: Responder citando

Podrías volver a postearlo marcando en la parte de abajo "Deshabilitar HTML en este mensaje" ? es que si no confunde los "<" y ">" con etiquetas de HTML y se come parte del código. Y ya de paso si escribes el código entre [code] y [/code] aun mejor ya que será mas comodo de leer.
Volver arriba
Ver perfil de usuario Enviar mensaje privado
Mensaje    Asunto: Responder citando

Perdona Leo, nunca había usado esas opciónes, entre otras cosas porque no sabía lo que significaban. Pero ya lo se para otra vez.

Bueno aqui te dejo el código:
Código:

void __fastcall TfrmPrincipal::GenerarMiInforme(TDataSet* dataset, TDBGrid *grid, AnsiString titulo1, AnsiString titulo2)
{
 TStringList* campos = new TStringList;

 if(dataset->IsEmpty())
    return;
 if(dataset->RecordCount==0)
    return;

 //CON ESTA FUNCION LO QUE HAGO ES GENERAR UN INFORME/LISTADO DE LA INFORMACIÓN QUE MUESTRO
 //EN EL dbGRID

 if(grid!=NULL) // PARA CUANDO EL DBGRID LLEVA CAMPOS LOOKUP-LISTAS DESPLEGABLES
   {
    for(int i = 0; i < grid->Columns->Count; i ++)
       {
        if(i>=grid->Columns->Count)
           continue;
        if(!grid->Columns->Items[i]->Visible)
           continue;

        try{
          campos->Append(grid->Columns->Items[i]->FieldName);
         }
        catch(...)
         {
          continue;
         }

       }
   }
 else
   {
    //PONEMOS LOS TITULOS DE LAS COLUMNAS
    for(int i=0; i < dataset->FieldDefs->Count ; i++)
     {
      try{
         if(dataset->FieldByName(dataset->FieldDefs->Items[i]->Name)->Visible==false)
            continue;
         campos->Append(dataset->FieldDefs->Items[i]->Name);
        }
      catch(...)
        {
         continue;
        }
     }
   }

  if (campos->Count < 1)
      throw Exception("No hay campos seleccionados.");

  static TQuickRep* qr = 0;

  if (qr)
     delete qr;

  dataset->DisableControls();

    qr = new TQuickRep(Application);
    qr->DataSet = dataset;
    qr->Name = "QR" + String(Time().FormatString("hhmmss"));
    AnsiString sTemp=Time();
    sTemp=ReemplazaTexto(sTemp,":","");
    qr->Name="QR" + sTemp;

    TQRBand* bandPageHeader   = qr->CreateBand(rbPageHeader);
    TQRBand* bandPageFooter   = qr->CreateBand(rbPageFooter);
    TQRBand* bandColumnHeader = qr->CreateBand(rbColumnHeader);
    TQRBand* bandDetail       = qr->CreateBand(rbDetail);

    qr->Units = MM;
    qr->Page->LeftMargin=5;
    qr->Page->RightMargin=5;
    qr->BeforePrint=MiBeforePrintReport;

    bandPageHeader->Size->Height      = 15;
    bandPageHeader->Frame->Color      = clBlack;
    bandPageHeader->Frame->Width      = 2;
    bandPageHeader->Frame->DrawTop    = true;
    bandPageHeader->Frame->DrawBottom = true;
    bandPageHeader->Frame->DrawLeft   = true;
    bandPageHeader->Frame->DrawRight  = true;

    TQRLabel *QRLabelTitu;
    QRLabelTitu              = new TQRLabel(bandPageHeader);
    QRLabelTitu->Parent      = bandPageHeader;
    QRLabelTitu->BringToFront();
    QRLabelTitu->Left      = 15;
    QRLabelTitu->Top       = 10;
    QRLabelTitu->Caption     = titulo1;
    QRLabelTitu->Alignment   = taLeftJustify;
    QRLabelTitu->Font->Style = QRLabelTitu->Font->Style << fsBold;
    QRLabelTitu->Font->Name  = "MS Sans Serif";
    QRLabelTitu->AutoSize    = false;
    QRLabelTitu->Transparent = true;

    TQRLabel *QRLabelTitu2;
    QRLabelTitu2              = new TQRLabel(bandPageHeader);
    QRLabelTitu2->Parent      = bandPageHeader;
    QRLabelTitu2->BringToFront();
    QRLabelTitu2->Left      = 15;
    QRLabelTitu2->Top       = 30;
    QRLabelTitu2->Font->Size=6;
    QRLabelTitu2->Transparent = true;
    QRLabelTitu2->Caption     = titulo2;
    QRLabelTitu2->Alignment   = taLeftJustify;
    QRLabelTitu2->WordWrap    = true;


    bandPageFooter->Size->Height   = 5;
    bandPageFooter->Frame->DrawTop = true;
    bandPageFooter->Frame->Color   = clBlack;
    bandPageFooter->Frame->Width   = 2;

    bandColumnHeader->Color = clSilver;
    bandColumnHeader->Size->Height = 8;

    TQRSysData* QRSysData  = new TQRSysData(bandPageHeader);
    /*QRSysData->Parent      = bandPageHeader;
    QRSysData->Data        = qrsReportTitle;
    QRSysData->AlignToBand = true;
    QRSysData->Alignment   = taLeftJustify;
    QRSysData->Font->Style = TFontStyles() << fsBold;
    QRSysData->Top        += 10;   */

    QRSysData              = new TQRSysData(bandPageFooter);
    QRSysData->Parent      = bandPageFooter;
    QRSysData->Data        = qrsPageNumber;
    QRSysData->AlignToBand = true;
    QRSysData->Alignment   = taRightJustify;

//    sTemp= qr->QRPrinter->PageNumber;
//    sTemp=sTemp + "/" + qr->QRPrinter->PageCount;
    QRSysData->Text        = "Página ";
    QRSysData->Top        += 4;

    // Calcula el alto y el ancho medio de una letra
    TForm* mainForm = Application->MainForm;
    mainForm->Font->Name="Arial";
    mainForm->Font->Size=8;
    mainForm->Canvas->Font->Assign(bandDetail->Font);
    int charWidth  = mainForm->Canvas->TextWidth("x");
    int charHeight = mainForm->Canvas->TextHeight("Xg");
    mainForm->Canvas->Font->Assign(mainForm->Font);

    bandDetail->Font=mainForm->Font;
    bandPageHeader->Font=mainForm->Font;
    bandColumnHeader->Font=mainForm->Font;

    // Definimos la altura de las bandas de cabecera y detalle
    bandColumnHeader->Height = charHeight*2;
    bandDetail->Height       = charHeight + 2;

    // Añade el texto
    TQRLabel *QRLabel;
    TQRDBText *QRDBText;
    int pos = 0;


    for (int i=0; i<campos->Count; i++)
    {
        String fieldName = campos->Strings[i];
        AnsiString sDisplayLabel,sTextoEti=fieldName;
        sTextoEti=ReemplazaTexto(sTextoEti," ","\r\n" );
        TField* field = qr->DataSet->Fields->FieldByName(fieldName);
        sDisplayLabel = qr->DataSet->Fields->FieldByName(fieldName)->DisplayLabel;

        QRLabel              = new TQRLabel(bandColumnHeader);
        QRLabel->Parent      = bandColumnHeader;
        QRLabel->BringToFront();
        QRLabel->AutoSize    = false;
        QRLabel->Transparent = true;
        QRLabel->WordWrap=true;
        QRLabel->Height=bandColumnHeader->Height;
        //QRLabel->Caption     = sTextoEti;
        QRLabel->Caption     = sDisplayLabel;

        sTemp = "lbl" + fieldName;
        QRLabel->Name=ReemplazaTexto(sTemp," ", "");

        //if(field->DisplayWidth>255)
        //field->DisplayWidth = 30;
        QRLabel->Width       = field->DisplayWidth * charWidth;
        QRLabel->Left        = pos;
        QRLabel->Top         = 2;

        QRDBText            = new TQRDBText(bandDetail);
        QRDBText->Parent    = bandDetail;
        QRDBText->BringToFront();

        sTemp = "QRDBText" + fieldName;
        QRDBText->Name=ReemplazaTexto(sTemp," ", "");

        QRDBText->AutoSize  = false;
        QRDBText->Color     = bandDetail->Color;
        QRDBText->Left      = pos;
        QRDBText->Top       = 2;
        QRDBText->Width     = QRLabel->Width;
        QRDBText->DataSet   = dataset;
        QRDBText->DataField = fieldName;

        // Justificar a la derecha si es un campo numerico
        //try{
        if(dataset->FieldByName(fieldName)->DataType==ftFloat ||
           dataset->FieldByName(fieldName)->DataType==ftSmallint ||
           dataset->FieldByName(fieldName)->DataType==ftInteger)
          {
           QRLabel->Alignment  = taRightJustify;
           QRDBText->Alignment = taRightJustify;
           if(QRLabel->Caption.AnsiPos("_") >0 )
             {
              bandDetail->Font->Size=6;
              bandColumnHeader->Font->Size=6;
              field->DisplayWidth =4;
             }
           else
             {
              if(QRLabel->Caption.AnsiPos("\r\n"))
                field->DisplayWidth = 20;
              else if(QRLabel->Caption.AnsiPos("INTERVENCION") )
                field->DisplayWidth = 25;
              else if(QRLabel->Caption.AnsiPos("ENERO") ||
                      QRLabel->Caption.AnsiPos("FEBRERO") ||
                      QRLabel->Caption.AnsiPos("MARZO") ||
                      QRLabel->Caption.AnsiPos("ABRIL") ||
                      QRLabel->Caption.AnsiPos("MAYO") ||
                      QRLabel->Caption.AnsiPos("JUNIO") ||
                      QRLabel->Caption.AnsiPos("JULIO") ||
                      QRLabel->Caption.AnsiPos("AGOSTO") ||
                      QRLabel->Caption.AnsiPos("SEPTIEMBRE") ||
                      QRLabel->Caption.AnsiPos("OCTUBRE") ||
                      QRLabel->Caption.AnsiPos("NOVIEMBRE") ||
                      QRLabel->Caption.AnsiPos("DICIEMBRE")   )
                field->DisplayWidth = 8;
              else if(QRLabel->Caption.AnsiPos("Núm") ||
                      QRLabel->Caption.AnsiPos("Metro") )
                field->DisplayWidth = 7;
              else if(QRLabel->Caption=="CP")
                field->DisplayWidth = 6;
              else
                field->DisplayWidth = 12;
             }
           QRLabel->Width = field->DisplayWidth * charWidth;
           QRDBText->Width     = QRLabel->Width;
          }
        //catch(...)
        else
          {
           if(QRLabel->Caption.AnsiPos("SERVICIO") )
              field->DisplayWidth = 25;
           else if(QRLabel->Caption.AnsiPos("AGENTE") )
              field->DisplayWidth = 40;
           else if(QRLabel->Caption.AnsiPos("Núm. ") ||
                   QRLabel->Caption.AnsiPos("Provincia") ||
                   QRLabel->Caption.AnsiPos("Metro") )
              field->DisplayWidth = 8;
           else if(QRLabel->Caption.AnsiPos("Nº") ||
                   QRLabel->Caption.AnsiPos("PISO") ||
                   QRLabel->Caption.AnsiPos("Piso") ||
                   QRLabel->Caption.AnsiPos("Núm.") ||
                   QRLabel->Caption.AnsiPos("Puerta") ||
                   QRLabel->Caption.AnsiPos("LETRA") )
              field->DisplayWidth = 4;
           else if(QRLabel->Caption.AnsiPos("Fec") ||
                   QRLabel->Caption.AnsiPos("Sigla") ||
                   QRLabel->Caption.AnsiPos("FEC") ||
                   QRLabel->Caption.AnsiPos("HORA") ||
                   QRLabel->Caption.AnsiPos("DNI") ||
                   QRLabel->Caption.AnsiPos("Tfno") ||
                   QRLabel->Caption.AnsiPos("RET"))
              field->DisplayWidth = 8;
           else if(QRLabel->Caption.AnsiPos("Municipio") ||
                   QRLabel->Caption.AnsiPos("BASTIDOR") ||
                   QRLabel->Caption.AnsiPos("Actividad")  )
              field->DisplayWidth = 12;
           else if(QRLabel->Caption.AnsiPos("TFNO") ||
                   QRLabel->Caption.AnsiPos("FAX"))
              field->DisplayWidth = 12;
           else if(QRLabel->Caption.AnsiPos("Padre") ||
                   QRLabel->Caption.AnsiPos("Madre"))
              field->DisplayWidth = 6;
           else if(QRLabel->Caption.AnsiPos("Direcci") ||
                   QRLabel->Caption.AnsiPos("DOMI") ||
                   QRLabel->Caption.AnsiPos("Mercader"))
              field->DisplayWidth = 20;
           else if(QRLabel->Caption.AnsiPos("Nombre"))
               field->DisplayWidth = 15;
           else if(QRLabel->Caption.AnsiPos("Apell") ||
                   QRLabel->Caption.AnsiPos("Nacionalidad"))
              field->DisplayWidth = 10;
           else if(QRLabel->Caption.AnsiPos("MATRÍCULA") ||
                   (QRLabel->Caption.AnsiPos("Num.") && QRLabel->Caption.AnsiPos("Docu.") )||
                   QRLabel->Caption.AnsiPos("TIPO") ||
                   QRLabel->Caption.AnsiPos("COLOR") ||
                   QRLabel->Caption.AnsiPos("MODELO") ||
                   QRLabel->Caption.AnsiPos("MARCA"))
              field->DisplayWidth = 10;
           else
              field->DisplayWidth = 30;
           QRLabel->Width = field->DisplayWidth * charWidth;
           QRDBText->Width     = QRLabel->Width;
          }

        pos += QRLabel->Width + QRLabel->Font->Size;
    }

    // Cambia la orientación del papel dependiendo del ancho del texto
    if (pos < bandDetail->Width)
        qr->Page->Orientation = poPortrait;
    else
        qr->Page->Orientation = poLandscape;

    qr->ReportTitle = titulo2;

    // Mostramos el report
    qr->Prepare();
    qr->Preview();
 delete campos;

 dataset->EnableControls();
 dataset->First();
}
//---------------------------------------------------------------------------
[img][/img][img][/img][img][/img]
Volver arriba
Ver perfil de usuario Enviar mensaje privado Enviar email MSN Messenger
Mensaje    Asunto: Responder citando

El problema está en los campos de tipo Blob, o sea, los Memos, gráficos etc... en el BCB6 funciona bien incluso con este tipo de campos, pero en el BCB4 no. Podrías solucionarlo detectando los campos de tipo "ftMemo" y en vez de usar para ellos el TQRDBText usa el TQRDBRichText.
Volver arriba
Ver perfil de usuario Enviar mensaje privado
Mensaje    Asunto: Responder citando

Gracias Leo, pero creo que el problema no esta en los campos blob o graficos, pues en los DBGrid solo muestro como máximo char de 255, fechas, números.
Seguire probrando a ver si veo algo más.

Y de paso si me indicas como subir en algún post alguna imagen de ejemplo te lo agradecería.

Gracias por estar siempre ahí.
Saludos desde Murcia!
Volver arriba
Ver perfil de usuario Enviar mensaje privado Enviar email MSN Messenger
Mensaje    Asunto: Responder citando

En las pruebas que hice solo pude reproducirlo con una tabla que tenia campos de tipo Memo y solo en el BCB4, en la 6 no daba problemas. Al ocultarlos dejaba de ocurrir. Lo que pasaba era por ejemplo que aparecía el primer registro solo en la primera página y el resto en otra página y cosas así.

Si me envías un pequeño ejemplo con una tabla incluida en el que se reproduzca el problema podría mirarlo. Mi email:

leosoftware ARROBA gmail PUNTO com
Volver arriba
Ver perfil de usuario Enviar mensaje privado
Mensaje    Asunto: Responder citando

Gracias Leo, una vez más.

Efectivamente el problema se soluciona añadiendo la linea:

QRDBText->WordWrap = false; //PONEMOS ESTA LINEA PARA EVITAR SALTOS DE PAG. EN BLANCO.

Lo pongo aquí para compartirlo con todos. El error se da en la versión del QuickReport que utiliza el BCB4.

Saludos.
Volver arriba
Ver perfil de usuario Enviar mensaje privado Enviar email MSN Messenger
Mostrar mensajes de anteriores:   
Cambiar a:  
No puedes publicar temas nuevos en este foro
No puedes responder a temas en este foro
No puedes editar tus mensajes en este foro
No puedes borrar tus mensajes en este foro
No puedes votar en las encuestas de este foro


Hosting WordPress Indedmedia desde 3,99 €
© 2002–2026 Club Builder · Funciona con phpBB.