Spire.XLS for .NET is a professional Excel .NET library that can be used to any type of .NET( C#, VB.NET, ASP.NET, .NET Core) application, both ASP.NET web sites and Windows Forms application.

Thu Dec 27, 2012 4:27 pm

Dear Support,

I am writing to determine if anything as part of the evaluation process would break/modify VB code in an excel spreadsheet. Here is the scenario, I have a fairly complex Excel Spreadsheet with several sheets and lots of VB code. What I'm trying to do is automate a process via the web that will insert my starting data into this Excel Spreadsheet. I have accomplished this with very little code and that part works fine. Here is my code:

Code: Select all
Workbook workbook = new Workbook();
workbook.LoadFromFile(@sDriveLetter + ":\\inetpub\\files\\reports\\templates\\Tech_Template.xls", ExcelVersion.Version97to2003);
Worksheet worksheet = workbook.Worksheets[0];
worksheet.InsertDataTable(tblFinal, false, 2, 1);
worksheet.InsertDataTable(tblRefHistory, false, 2, 27);
workbook.SaveToFile(@sDriveLetter + ":\\inetpub\\files\\reports\\TechReview-" + DateTime.Now.Year + DateTime.Now.Day + iSecond + ".xls", ExcelVersion.Version97to2003);


Now when I open the spreadsheet I see the eval sheet but then errors start happening. I first get a generic:

File error: data may have been lost

And then I start getting all sorts of visual basic errors about being unable to access parts of the document. If I try to modify any parts of the spreadsheet via the VB scripts I start getting errors about unprotecting the sheet but there is no protections on the sheet before and as far as I can tell there are none after the data has been saved.

I have even tried just opening the file and saving the file without adding anything and the error still happens. So it seems to be just the opening and closing of the spreadsheet is causing all sorts of errors.

So my questions are:

1. Does the eval version do anything to the VB code in excel
2. Should my document be coming up as protected after I open/save it? If so, is there a way to prevent this.

Thanks,

Richard

rbrynteson
 
Posts: 11
Joined: Wed Jun 20, 2012 3:58 am

Fri Dec 28, 2012 6:27 am

Hello Richard,

Thanks for your inquiry.
Please don't mind that we add the answers after your questions.
1. Does the eval version do anything to the VB code in excel
No,it doesn't.
2. Should my document be coming up as protected after I open/save it? If so, is there a way to prevent this.
We use some excel documents with VB code to do some tests, but we don't reproduce the errors. Could you please provide us your Excel file? Please upload the Excel file as a .zip file or you can send the Excel file to support@e-iceblue.com directly. So that we can reproduce the errors, and work out a solution for you soon. Thank you!

Best regards,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2325
Joined: Wed Jun 27, 2012 8:50 am

Sat Dec 29, 2012 5:09 am

Amy

I have e-mailed you the file we are using.

Thanks,

Richard

rbrynteson
 
Posts: 11
Joined: Wed Jun 20, 2012 3:58 am

Sat Dec 29, 2012 7:30 am

Hello Richard,

Thanks for your feedback.
We have receieved your template file from e-mail. We check the template file and find that there are some data types in it which spire.xls don't support. We are sorry for the inconvenience. We will do some researches to try to fix it. Because of we will have a 4-day New Year holiday from Dec.30 2012 to Jan.02 2013(Pacific Time), we may give you a confirm next week. If we can fix it, we will tell you our schedule.

Best regards,
Amy
E-iceblue support team
User avatar

amy.zhao
 
Posts: 2325
Joined: Wed Jun 27, 2012 8:50 am

Return to Spire.XLS