AV When Exporting To PDF

edited March 2005 in FastReport 3.0
I'm getting an AV when I Load a report, save to pdf, exit and re load the report. The AV is occuring on the following line of my code,

((TfrxMemoView*)frxReport->FindObject("Memo4"))->Text = cmbProducts->Items->Strings[cmbProducts->ItemIndex];

And in fact, ((TfrxMemoView*)frxReport->FindObject("Memo4")) = NULL the second time my code runs.

The AV doesn't occur if I set frxPDFExport1->ShowDialog to false though (but then the user can't choose a directory to save the file to)!!

Any ideas anyone?

Thanks,

Andy

Comments

  • edited 11:20PM
    OK, looks like I'm talking to myself again ;)

    I've sussed this out and I'm not sure if it constitutes a bug or not! It could (and probably will) be pushed into the "Intended Behaviour" pile.

    Basically, I load a report using the following,

    frxReport->LoadFromFile("Data\\99\\PartInfo.qha");

    Set up some titles and ->ShowReport

    If the user decides to Export the report and uses the Save As dialog then FastReports is actually changing the Current Directory to the one the user selects. So, when I next load my report, it doesn't load (and I didn't check that it loaded correctly but I probably should have!),

    frxReport->LoadFromFile("Data\\99\\PartInfo.qha");

    My current directory isn't what it was! ;)

    Bug or Intended Behaviour? I know where I'll put my money ;)

    Andy
  • edited 11:20PM
    Open/Save dialogs always change the current directory. You shouldn't use relative path when loading/saving your reports.
  • edited 11:20PM
    Agreed. Having looked into this I can confirm that this is the case. After developing for 12+ years I can't believe I haven't encountered it before.

    Apologies for wasting posting space ;)

    Andy

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.