Jump to content

Can not open file


mierlp

Recommended Posts

Hi,

 

Within my application i have a form which contains a listbox with all tables. The user can select

a table he wants to export. When he hits the export button the following code will be executed:

 

 
     // Database 
     if NOT dmArtist.Artist.Active then
        dmArtist.Artist.Active:=TRUE;

     // Excel export 
     scExcelExport.DataSet:=dmArtist.Artist;
     scExcelExport.WorksheetName:='Artiesten';
     scExcelExport.HeaderText.text:='Artiesten per ' +DateToStr(Date) ;
     scExcelExport.ExcelVisible:=false;
     try
       scExcelExport.ExportDataset;
       ExportFile:='Artiesten per ' +FormatDateTime('hhmmss', Time) ;
       scExcelExport.SaveAs(UniServerModule.FilesFolderPath+ExportFile,ffXLS)
     finally
       scExcelExport.Disconnect;

       // Save export
       UniSession.SendFile(UniServerModule.FilesFolderPath+ExportFile+'.xls', 'Artiesten.xls');
     end;
  end;

 

I save the file to UniServerModule.FilesFolderPath and every file will be created. Sometimes after

3 or 5 export actions (files are created) i got the followin message :

 

'Cannot open file C:\Data\Delphi\UniGui\myEventWeb\cache\Artiesten per 133412.xls'

The process has no access to the file because it's used by a other proces

 

See attachement...it's in Dutch but the translation is above.

 

I test i local as you can see by the path names.

 

Regards Peter

post-510-0-03816000-1356612921.png

Link to comment
Share on other sites

Hi,

 

Within my application i have a form which contains a listbox with all tables. The user can select

a table he wants to export. When he hits the export button the following code will be executed:

 

 
     // Database 
     if NOT dmArtist.Artist.Active then
        dmArtist.Artist.Active:=TRUE;

     // Excel export 
     scExcelExport.DataSet:=dmArtist.Artist;
     scExcelExport.WorksheetName:='Artiesten';
     scExcelExport.HeaderText.text:='Artiesten per ' +DateToStr(Date) ;
     scExcelExport.ExcelVisible:=false;
     try
       scExcelExport.ExportDataset;
       ExportFile:='Artiesten per ' +FormatDateTime('hhmmss', Time) ;
       scExcelExport.SaveAs(UniServerModule.FilesFolderPath+ExportFile,ffXLS)
     finally
       scExcelExport.Disconnect;

       // Save export
       UniSession.SendFile(UniServerModule.FilesFolderPath+ExportFile+'.xls', 'Artiesten.xls');
     end;
  end;

 

I save the file to UniServerModule.FilesFolderPath and every file will be created. Sometimes after

3 or 5 export actions (files are created) i got the followin message :

 

'Cannot open file C:\Data\Delphi\UniGui\myEventWeb\cache\Artiesten per 133412.xls'

The process has no access to the file because it's used by a other proces

 

See attachement...it's in Dutch but the translation is above.

 

I test i local as you can see by the path names.

 

Regards Peter

 

Well, I am not sure, but maybe you need to add:

 

procedure TUniServerModule.UniGUIServerModuleCreate(Sender: TObject);
begin
 MimeTable.AddMimeType('xls', 'Excel');
end;

Link to comment
Share on other sites

Hi,

 

When running the apps I got the message: 'Extension already exists'

 

Regards Peter

 

 

 

Well, I am not sure, but maybe you need to add:

 

procedure TUniServerModule.UniGUIServerModuleCreate(Sender: TObject);
begin
 MimeTable.AddMimeType('xls', 'Excel');
end;

Link to comment
Share on other sites

Hi,

 

When running the apps I got the message: 'Extension already exists'

 

Regards Peter

 

Hi

 

And the problem is still there even when i add the code:

 

procedure TUniServerModule.UniGUIServerModuleCreate(Sender: TObject);
begin  
 MimeTable.AddMimeType('xls', 'Excel');
end;

 

After 3-5 download the file i get the error message.

 

Regards Peter

Link to comment
Share on other sites

  • 3 months later...
  • Administrators

 

Estimates, and had the same problem for some time, I could indicate if this problem had a solution? , Is used to export to excel so your help would be very valuable  :)
 
greetings and thanks
 
mmurgas

 

You must make sure before you call SendFile export is completed and/or file is not opened exclusively by any other process.

Link to comment
Share on other sites

for me this code is correct, but I broke my head trying to export my data :blink:

 

  // Database 
      if NOT dmArtist.Artist.Active then
         dmArtist.Artist.Active:=TRUE;

      // Excel export 
      scExcelExport.DataSet:=dmArtist.Artist;
      scExcelExport.WorksheetName:='Artiesten';
      scExcelExport.HeaderText.text:='Artiesten per ' +DateToStr(Date) ;
      scExcelExport.ExcelVisible:=false;
      try
        scExcelExport.ExportDataset;
        ExportFile:='Artiesten per ' +FormatDateTime('hhmmss', Time) ;
        scExcelExport.SaveAs(UniServerModule.FilesFolderPath+ExportFile,ffXLS)
      finally
        scExcelExport.Disconnect;

        // Save export
        UniSession.SendFile(UniServerModule.FilesFolderPath+ExportFile+'.xls', 'Artiesten.xls');
      end;
   end;
Link to comment
Share on other sites

  • Administrators

 

for me this code is correct, but I broke my head trying to export my data :blink:

 

  // Database 
      if NOT dmArtist.Artist.Active then
         dmArtist.Artist.Active:=TRUE;

      // Excel export 
      scExcelExport.DataSet:=dmArtist.Artist;
      scExcelExport.WorksheetName:='Artiesten';
      scExcelExport.HeaderText.text:='Artiesten per ' +DateToStr(Date) ;
      scExcelExport.ExcelVisible:=false;
      try
        scExcelExport.ExportDataset;
        ExportFile:='Artiesten per ' +FormatDateTime('hhmmss', Time) ;
        scExcelExport.SaveAs(UniServerModule.FilesFolderPath+ExportFile,ffXLS)
      finally
        scExcelExport.Disconnect;

        // Save export
        UniSession.SendFile(UniServerModule.FilesFolderPath+ExportFile+'.xls', 'Artiesten.xls');
      end;
   end;

 

What error code or message do you receive?

uniGUI version?

 

What type of component scExcelExport is?

Link to comment
Share on other sites

  • 3 weeks later...
  • 9 years later...

There are Windows environments where the following applies.
There's an environment that doesn't work.
MimeTable.AddMimeType('gbr', 'gbr');
MimeTable.AddMimeType('pptx', 'pptx');
- the summit
Windows 10 Pro
- Problematic environment
Windows Server 2016 Standard
Ver : 1607

Whether there are other settings or what needs to be installed.
Please let me know.

Link to comment
Share on other sites

I checked the log and it says Access Denied.
I'll ask you where to check.

hyper_server.exe: 00000778: 09:38:42 [HandleFileRequest[]]:Access denied: D:\HyperServer\bin64\cache\connectvd_exe\n1\1_t7l22QsIvY10BE53054\$$$\5.시스템분과_230112081142_230112090227_230119093822.PPTX.
hyper_server.exe: 00000560: 09:39:16 [HandleFileRequest[]]:Access denied: D:\HyperServer\bin64\cache\connectvd_exe\n1\1_t7l22QsIvY10BE53054\$$$\[IATEC] BN41-02990B(22.03.04)_BOT_230118123313.GBR.

Link to comment
Share on other sites

Hello

The same symptoms appear in both OS environments. Please confirm.

- Windows Server 2016 Standard
   Ver : 1607

- Windows Server 2008 R2 Enterprise

   Service Pack 1

============================================================================================================

Uploading files is fine.
No response when downloaded in edge environment.
The server log file displays an "Access denied" log.

hyper_server.exe: 00000778: 09:38:42 [HandleFileRequest[0.0.0.0]]:Access denied: D:\HyperServer\bin64\cache\connectvd_exe\n1\1_t7l22QsIvY10BE53054\$$$\5.시스템분과_230112081142_230112090227_230119093822.PPTX.
hyper_server.exe: 00000560: 09:39:16 [HandleFileRequest[0.0.0.0]]:Access denied: D:\HyperServer\bin64\cache\connectvd_exe\n1\1_t7l22QsIvY10BE53054\$$$\[IATEC] BN41-02990B(22.03.04)_BOT_230118123313.GBR.

=============================================================================================================

- enquiry
. Check if regedit Path is wrong in Windows NT environment.
I will ask you where and how to add it.
It's urgent.

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
×
×
  • Create New...