Author |
Message |
garywtx
Joined: Fri Nov 23, 2018 9:54 am Posts: 7
|
XLS file in use throws NET exception
Using Win 7 console application, if I try to write to a XLS file that is in use, it throws the NET Exception dump into the console windows, is there a way to prevent this?
sample error on console screen
The process cannot access the file wpd.xls because it is being used by another process. at System. IO. etc
|
Fri Nov 23, 2018 4:17 pm |
|
|
daniela
Joined: Fri Feb 03, 2006 12:23 pm Posts: 199 Location: Brasov, Romania
|
Re: XLS file in use throws NET exception
If you can control how the file is open for the first time, you can open the xls file in share mode.
Then, you can create a FileStream, also in share mode:
System.IO.FileStream stream = new System.IO.FileStream(filepath, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.Read);
and use this stream with the method that reads the Excel file.
_________________ EasyXLS Team .NET and Java library to read and write Excel files Facebook X Reddit LinkedIn
|
Mon Nov 26, 2018 8:43 am |
|
|
garywtx
Joined: Fri Nov 23, 2018 9:54 am Posts: 7
|
Re: XLS file in use throws NET exception
Ok, not what I needed, I need it to not throw the exception info all over the application screen, and force the application to stop responding, and to allow me to grab the error from easy_getError()
I would assume if there is a easy_getError() function, that your application would catch the exception dump
|
Tue Nov 27, 2018 3:27 am |
|
|
daniela
Joined: Fri Feb 03, 2006 12:23 pm Posts: 199 Location: Brasov, Romania
|
Re: XLS file in use throws NET exception
You can hide the console messages by setting as FALSE the parameter of ExcelOptions.setDisplayErrors() and then extract the error using ExcelDocument.easy_getError() method. More about: https://www.easyxls.com/manual/tips-and-tricks/error-messages.html
_________________ EasyXLS Team .NET and Java library to read and write Excel files Facebook X Reddit LinkedIn
|
Tue Nov 27, 2018 3:34 am |
|
|
garywtx
Joined: Fri Nov 23, 2018 9:54 am Posts: 7
|
Re: XLS file in use throws NET exception
I dont see any examples on how to use Excel Options, testing with code
oXLS := CreateObject( 'EasyXLS.ExcelDocument' )
oXLSOptions := CreateObject( 'EasyXLS.ExcelOptions' ) oXLSOptions:DisplayErrors() oXLSOptions:setDisplayErrors( 0 )
The last two lines are basically telling me there is no such method, so what am I missing here?
|
Tue Nov 27, 2018 12:00 pm |
|
|
daniela
Joined: Fri Feb 03, 2006 12:23 pm Posts: 199 Location: Brasov, Romania
|
Re: XLS file in use throws NET exception
Unfortunately that method is static and cannot be accessed from VBScript. I supposed that you are using C# or another .NET programming language. You can try a "try/catch" statement.
_________________ EasyXLS Team .NET and Java library to read and write Excel files Facebook X Reddit LinkedIn
|
Wed Nov 28, 2018 5:27 am |
|
|
garywtx
Joined: Fri Nov 23, 2018 9:54 am Posts: 7
|
Re: XLS file in use throws NET exception
Not using a dot NET language, using xHarbour, a clipper clone, went with EasyXLS as it a OLE/COM+ package, problem is, even in a TRY/CATCH, it still dumps the data to the screen, and some time locks up the application
So I still need a working solution that does not lockup
|
Wed Nov 28, 2018 12:55 pm |
|
|
daniela
Joined: Fri Feb 03, 2006 12:23 pm Posts: 199 Location: Brasov, Romania
|
Re: XLS file in use throws NET exception
In this situation, we can provide you a demo version with ExcelOptions.setDisplayErrors() method also available for COM+. Let us know if you need 32-bit or 64-bit version.
_________________ EasyXLS Team .NET and Java library to read and write Excel files Facebook X Reddit LinkedIn
|
Thu Nov 29, 2018 4:50 am |
|
|
garywtx
Joined: Fri Nov 23, 2018 9:54 am Posts: 7
|
Re: XLS file in use throws NET exception
"Demo version" ?
So after purchasing the professional edition, I need to purchase another package? I don't see this on the list of products. We were under the impression that the professional package included all items
|
Thu Nov 29, 2018 6:56 am |
|
|
daniela
Joined: Fri Feb 03, 2006 12:23 pm Posts: 199 Location: Brasov, Romania
|
Re: XLS file in use throws NET exception
If you have already purchased the Professional Edition, then you will receive a patch for .NET Professional, not for the trial.
_________________ EasyXLS Team .NET and Java library to read and write Excel files Facebook X Reddit LinkedIn
|
Thu Nov 29, 2018 8:21 am |
|
|
garywtx
Joined: Fri Nov 23, 2018 9:54 am Posts: 7
|
Re: XLS file in use throws NET exception
The I need the 32 bit patch for professional.
And if we decided to purchase a server based license, will we need to request a fixed version also?
|
Thu Nov 29, 2018 1:48 pm |
|
|
garywtx
Joined: Fri Nov 23, 2018 9:54 am Posts: 7
|
Re: XLS file in use throws NET exception
Is there an actual company here? No response in almost 24 hrs, no response to telephone calls, so why did we pay for support if there is none?
|
Fri Nov 30, 2018 9:34 am |
|
|
daniela
Joined: Fri Feb 03, 2006 12:23 pm Posts: 199 Location: Brasov, Romania
|
Re: XLS file in use throws NET exception
You will receive the patch on Monday. When you will buy the server license, you can use the same patch.
_________________ EasyXLS Team .NET and Java library to read and write Excel files Facebook X Reddit LinkedIn
|
Sat Dec 01, 2018 3:03 am |
|
|