Recent

Author Topic: FPSpreadsheet: Error of visualization when opening a Excel file.  (Read 3254 times)

Jvan

  • Full Member
  • ***
  • Posts: 181
I used the Object Inspecto to open a Excel file in the FileName attribute of my WorkbookSource, and it works ok (Image 1), but when I run the app it doesn't open the file correctly (Image 2).

wp

  • Hero Member
  • *****
  • Posts: 11912
Re: FPSpreadsheet: Error of visualization when opening a Excel file.
« Reply #1 on: June 03, 2021, 10:03:06 pm »
Please post the file and sample code that you used.

Jvan

  • Full Member
  • ***
  • Posts: 181
Re: FPSpreadsheet: Error of visualization when opening a Excel file.
« Reply #2 on: June 03, 2021, 10:26:40 pm »
The problem is not the Excel file, I have just created a new one with a simple "Hola" and the same problem happened.

wp

  • Hero Member
  • *****
  • Posts: 11912
Re: FPSpreadsheet: Error of visualization when opening a Excel file.
« Reply #3 on: June 03, 2021, 11:06:09 pm »
I cannot confirm the issue - the file opens correctly in your program at runtime with my fpspreadsheet version (ccr-trunk). Are you using the OPM version? I remember that I improved this part some months ago.

There is an issue in your program: you must specify the unit with the file format reader/writer, in your case this is unit xlsxooxml - or use fpsallformats to add the readers/writers of all file formats supported. When you add one of these units to the uses clause of your program I think the file should open correctly also with the OPM version (I cannot test because don't have an OPM version of fpspreadsheet available at the moment).

If you are sure that your program will need only xlsx support you could turn off AutoDetectFormat in the workbooksource and select the FileFormat to be sfOOXML (which is the internal name for xlsx). This way the file opens a bit faster.

Like with database application I advise not to keep the FileName in the WorkbookSource until runtime. You had there the path d:\456.xlsx - which of course does not exist on my disk although you had provided the xlsx file in your upload. I had to edit the lfm file to replace this by the location on my disk in order to be able to open your project. Setting the FileName at designtime is just thought as a possibility to quickly look into the data file during designing, but later you must remove the Filename and set the filename at runtime (or call WorkbookSource.LoadFromSpreadsheetFile).

Jvan

  • Full Member
  • ***
  • Posts: 181
Re: FPSpreadsheet: Error of visualization when opening a Excel file.
« Reply #4 on: June 04, 2021, 03:46:25 am »
Thanks.

 

TinyPortal © 2005-2018