TfrxCrossView problem

I'm using FastReport VCL with C++ Builder 6.

I'm trying the fill a TfrxCrossView with the values from a StringGrid but I'm getting an error: EVariantTypeCastError with message 'Could not convert variant of type (String) into type (Double)'

I've been searching the net and the provided FastReport C++ Examples are VERY skimpy.
I a;so had a look at the relevant posts in this forum but that also did not solve my problem.

It seems like the problem arises when I'm trying to add a value to the CrossView that is represented as a string in the StringGrid. The values in the StringGrid reprsented as numericals do not create this problem.

Attached is an example of the stringgrid that I would like to print using the CrossView. If I print only the values from the first two columns it works fine, but when I include the contents of the 3rd column I get this error.

void __fastcall TfrmReportSettings::CreateImageReport(TfrxReportComponent *Sender)
{
    TfrxCrossView *CrossView = (TfrxCrossView*)frxCrossObject;
    Variant RowIdx, ColIdx, Text;

    CrossView = dynamic_cast <TfrxCrossView *> (Sender);
    if(CrossView == NULL) {return;}

    try
    {
        if (chkIncludeAnnotationsInfo->Checked)
        {
            for (int ColNo = 0; ColNo < ImageForm->AnnotationsInfoGrid->ColCount; ColNo ++)
            {
                for (int RowNo = 1; RowNo < ImageForm->AnnotationsInfoGrid->RowCount - 1; RowNo ++)
                {

                    RowIdx = RowNo;
                    ColIdx = ColNo;
                    Text = ImageForm->AnnotationsInfoGrid->Cells[ColNo][RowNo];
                    CrossView->AddValue(&RowIdx, 1, &ColIdx, 1, &Text, 1);
                }
            }
        }
    }
    catch (...)
    {
    }
}

I'm out of ideas and really don't know what to do anymore.

Any help will be appreciated

Thank you

Comments

  • gpigpi
    edited 4:43AM
    Try to set cells function to None
  • edited 4:43AM
    Awesome stuff! That solved the problem thank you!

    Funny, I was considering doing that , don't know why I didn't try it.
  • edited 4:43AM
    gpi wrote: »
    Try to set cells function to None

    Hello, could you explain me that? Please.
    Peace >

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.