Spire.XLS is a professional Excel API that enables developers to create, manage, manipulate, convert and print Excel worksheets. Get free and professional technical support for Spire.XLS for .NET, Java, Android, C++, Python.

Sat Oct 21, 2023 12:00 pm

i am the owner of my system. the ownership name is mine when checking adv settings under security tab. i signed in to my windows 11 system with the same account. I can copy and move folders to different locations and drives. But when I wrote this code, I got an error. Why can't I overwrite an excel file?
I thought about disposing it before saving it but then I'd probably get an exception informing me that the workbook is null. i tried a different directory just to be sure and the same thing happened. saving = exception while saving as a diff name = pass

Code: Select all
private void Form1_Load(object sender, EventArgs e)
{
    Workbook wb = new Workbook();

    wb.LoadFromFile(@"C:\Users\abc\x\Appendix\JOR 2023.xlsx");

    //doesn't work. access denied
    wb.Save();

    //works because i renamed the file
    wb.SaveToFile(@"C:\Users\abc\x\Appendix\NEW JOR 2023.xlsx");

    Application.Exit();
}

wildheart25c
 
Posts: 2
Joined: Fri Mar 06, 2020 5:44 am

Mon Oct 23, 2023 8:20 am

Hi,

Thank you for your inquiry.
I have tested the code you provided, but I was unable to reproduce the issue. Have you tried loading and saving a file with another drive path? Additionally, please provide us with your specific error information and system environment (e.g., Windows 10, 64-bit) to assist us in further investigation, some error details screenshots should be helpful. You can attach the information here or send it to us via email ([email protected]). Thank you in advance.

Sincerely,
Ula
E-iceblue support team
User avatar

Ula.wang
 
Posts: 282
Joined: Mon Aug 07, 2023 1:38 am

Mon Nov 13, 2023 6:09 am

Hello,

Did your problem have resolved? Please tell us your test result.
If you have any issue, just feel free to contact us.

Best Regards,
Ula
E-iceblue support team
User avatar

Ula.wang
 
Posts: 282
Joined: Mon Aug 07, 2023 1:38 am

Return to Spire.XLS