We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Gridweb - loading a new excel

dear support


I am using version 8.3 of the gridweb and am experiencinglots of problems currently after having switched from version 8.2

As an example, I cant load a new excel file anymore in my gridweb object

My code is very simple, when the user clicks a button, a new file is laoded in the gridweb object.

Partial Class _Default
Inherits System.Web.UI.Page
Public Shared licenseweb As New Aspose.Cells.GridWeb.License
Public Shared asposecellslicense As String = My.Computer.Registry.GetValue(“HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\MWorks”, “AsposeCellsLicense”, “”)
Public ms1 As New System.IO.MemoryStream(System.IO.File.ReadAllBytes(“E:\MWorks configuration\MWorks_OnDemandReports\Templates\integral.xlsx”))
Public ms2 As New System.IO.MemoryStream(System.IO.File.ReadAllBytes(“E:\MWorks configuration\MWorks_OnDemandReports\Templates\Test_without_IP21.xlsx”))
Public Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles GridWeb1.Load
If GridWeb1.IsPostBack Or Page.IsPostBack Then Exit Sub
licenseweb.SetLicense(asposecellslicense)
GridWeb1.Width = New Unit(1000, UnitType.Point)
GridWeb1.Height = New Unit(600, UnitType.Point)
GridWeb1.WebWorksheets.ImportExcelFile(ms2)
GridWeb1.WebWorksheets.RunAllFormulas()
End Sub
Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
GridWeb1.WebWorksheets.Clear()
GridWeb1.WebWorksheets.Clear()
GridWeb1.WebWorksheets.ImportExcelFile(ms1)
GridWeb1.WebWorksheets.Clear()
GridWeb1.WebWorksheets.ImportExcelFile(ms1)
End Sub
End Class


My web.config config

<?xml version="1.0"?>
<system.web>
</system.web>


The porblem is that, when I click the button, the gridweb object gets grayed out and is not laoded.


Hi,


Could you provide us a sample project (runnable) with v8.3.0, zip it and post us here to reproduce the issue on our end, we will check it soon. Also attach the template file if you have any.

By the way, I think you you may try to sink events for the Asp.NET button’s click if it makes any difference, see the sample line of code that you may add to Page_Load event:
e.g
Sample code:

Button1.Attributes(“onclick”) = "GridWeb1.updateData(); return GridWeb1.validateAll();"


Let us know if works fine now.

Thank you.

attached you have a very simple project.

It executes on version 8.2, but doesnt run on version 8.3
thank you

ay feedback on this - I was planning to work on this in the weekend…

Hi Guido,

Thanks for your posting and using Aspose.Cells for GridWeb.

We were able to replicate this issue with the latest version. It works fine with the older version though.

I have attached the following files for a reference


We have logged this issue in our database for investigation. We will look into it and fix this issue. Once, the issue is resolved or we have some other update for you, we will let you know asap.

This issue has been logged as

  • CELLSNET-43174 - Loading a new excel file does not work anymore in latest gridweb

Hi Guido,

Thanks for using Aspose.Cells for GridWeb.

The basic internal logic is changed, however it will not affect customer so much. Before the import file, you do not need to call clear function anymore.


If your code is below:




GridWeb1.WebWorksheets.ImportExcelFile(ms1)

GridWeb1.WebWorksheets.Clear()

GridWeb1.WebWorksheets.ImportExcelFile(ms1)


The instance of the workbook is kept, after you call clear, there is
no sheets left in the workbook instance, the next time you import the instance, all the sheets is already clear.


Your code shall change to:

Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim ms1 As New System.IO.MemoryStream(System.IO.File.ReadAllBytes("D:\grid_project\form_attachments\CELLSNET-43174.xlsx"))

GridWeb1.WebWorksheets.ImportExcelFile(ms1)
End Sub


I just appended the multiple clear and importExcelfile statements in the testing phase, as to debug the problem.


I had tested the code with
Public ms1 As New System.IO.MemoryStream(…)
Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
GridWeb1.WebWorksheets.ImportExcelFile(ms1)
End Sub
This does not work !!!

As I understand it, you suggest
Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim ms1 As New System.IO.MemoryStream(…)
GridWeb1.WebWorksheets.ImportExcelFile(ms1)
End Sub

The only difference in both is that a new memorystream objetc is created from the file. How would that resolve the problem ??

Hi Guido,

Thanks for your posting and using Aspose.Cells for GridWeb.

Actually, we are suggesting you not to call clear method. Just import your Excel file inside the GridWeb without calling GridWeb1.WebWorksheets.Clear() method. GridWeb will automatically clear the web worksheets in second import excel file.

So your following code

GridWeb1.WebWorksheets.ImportExcelFile(ms1)

GridWeb1.WebWorksheets.Clear()

GridWeb1.WebWorksheets.ImportExcelFile(ms1)

will be like this

GridWeb1.WebWorksheets.ImportExcelFile(ms1)
GridWeb1.WebWorksheets.ImportExcelFile(ms1)

the problem is still there.


If I keep the clear statement in front of the importexcelfile command, my gridweb object is blanked out, as i reported before.

If I follow your suggestion, and keep only importexcelfile, the gridweb is not updated at all with the new spreadsheet.

So your suggestion does not resolve the issue at all.



Hi Guido,

Thanks for your feedback and using Aspose.Cells for GridWeb.

We will look into these issues further and fix them and update you asap.

Hi Guido,

Thanks for using Aspose.Cells for GridWeb.

I have tested this issue with another sample project which I have attached for development team reference and was able to replicate this issue.

I tested this issue with the following sample code. Initially, it loads source1.xlsx file, then on clicking button1, it should load source2.xlsx file and on clicking button 2, it should load source3.xlsx file. But on clicking button 1 and button 2, it does nothing as you have said.

I have logged these findings against this issue. Please spare us some time. Once, there is some further update for you, we will let you know asap.

VB.NET



Partial Class _Default

Inherits System.Web.UI.Page

'Public Shared asposecellslicense As String = My.Computer.Registry.GetValue(“HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\MWorks”, “AsposeCellsLicense”, “”)

Public Shared licenseweb As New Aspose.Cells.GridWeb.License

Public Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles form1.Load

If GridWeb1.IsPostBack Or Page.IsPostBack Then Exit Sub

licenseweb.SetLicense(“F:\Shak-Data-R\Aspose\License\Aspose.Total.lic”)

'licenseweb.SetLicense(asposecellslicense)

GridWeb1.Width = New Unit(1000, UnitType.Point)

GridWeb1.Height = New Unit(600, UnitType.Point)

Dim ms1 As New System.IO.MemoryStream(System.IO.File.ReadAllBytes(“F:\Shak-Data-RW\Downloads\source1.xlsx”))

GridWeb1.WebWorksheets.ImportExcelFile(ms1)

GridWeb1.WebWorksheets.RunAllFormulas()

End Sub

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click

Dim ms1 As New System.IO.MemoryStream(System.IO.File.ReadAllBytes(“F:\Shak-Data-RW\Downloads\source2.xlsx”))

GridWeb1.WebWorksheets.ImportExcelFile(ms1)

End Sub

Protected Sub Button2_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button2.Click

Dim ms1 As New System.IO.MemoryStream(System.IO.File.ReadAllBytes(“F:\Shak-Data-RW\Downloads\source3.xlsx”))

GridWeb1.WebWorksheets.ImportExcelFile(ms1)

End Sub

End Class



Hi Guido,

Thanks for using Aspose.Cells for GridWeb.

Please use GridWeb1.ImportExcelFile(ms1) instead of GridWeb1.WebWorksheets.ImportExcelFile(ms1)



webworksheets is obsolete now.



you do not need to call calculateformula after import file


Please see the following code below




Partial Class _Default

Inherits System.Web.UI.Page

'Public Shared asposecellslicense As String = My.Computer.Registry.GetValue(“HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\MWorks”, “AsposeCellsLicense”, “”)

Public Shared licenseweb As New Aspose.Cells.GridWeb.License

Public Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles form1.Load

If GridWeb1.IsPostBack Or Page.IsPostBack Then Exit Sub

licenseweb.SetLicense(“F:\Shak-Data-R\Aspose\License\Aspose.Total.lic”)

'licenseweb.SetLicense(asposecellslicense)

GridWeb1.Width = New Unit(1000, UnitType.Point)

GridWeb1.Height = New Unit(600, UnitType.Point)

Dim ms1 As New System.IO.MemoryStream(System.IO.File.ReadAllBytes(“F:\Shak-Data-RW\Downloads\source1.xlsx”))

GridWeb1.WebWorksheets.ImportExcelFile(ms1)

End Sub

Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button1.Click

Dim ms1 As New System.IO.MemoryStream(System.IO.File.ReadAllBytes(“F:\Shak-Data-RW\Downloads\source2.xlsx”))

GridWeb1.ImportExcelFile(ms1)

End Sub

Protected Sub Button2_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button2.Click

Dim ms1 As New System.IO.MemoryStream(System.IO.File.ReadAllBytes(“F:\Shak-Data-RW\Downloads\source3.xlsx”))

GridWeb1.ImportExcelFile(ms1)

End Sub

End Class

Ok, thank you.


That works fine !! thanks for pointing me to the solution.

However, I am a liitle bit worried that Aspose changes the object model without notification. I now have to go,edit and retest all my programs. What other changes have been implemented without me knowing ? The release notes of version 8.3 says nothing about this change. Something to consider for next release !

Anyway, thank you for your help and this wonderfull product !

guido

I have another problem now, related to the use of worksheets and webworksheets


I was using gridweb1.webworksheets(…).seteditablerange(…), but now gridweb1.worksheets(…).seteditablerange does not exist, and gridweb1.webworksheets has no worksheets attached to it ( gridweb1.webworksheets(0)=nothing ) aftre loading the excel file using the gridweb1.importexcelfile function.

These modifications in the aspose.cells.gridweb class are really causing big problems… Any idea how to get the the seteditablerange working now. If I look at the online documentation, it indicates the seteditablerange is attached to aspsoe.cell.gridweb.worksheet, which apparently is not the case… So the documentation is apparently not ok.

So how to get the seteditablerange working in version 8.3 ??

thanks for your much appreciated help,




GuidoDeBouver:
Ok, thank you.

That works fine !! thanks for pointing me to the solution.

However, I am a liitle bit worried that Aspose changes the object model without notification. I now have to go,edit and retest all my programs. What other changes have been implemented without me knowing ? The release notes of version 8.3 says nothing about this change. Something to consider for next release !

Anyway, thank you for your help and this wonderfull product !

guido
Hi,

Thanks for your posting and using Aspose.Cells.

I have logged your concern and comment in our database against this issue. We will look into it and update you asap. Once, there is some news for you, we will let you know.

So how to get the seteditablerange working in version 8.3 ( see my above post ??? )


thanks

guido

Hi Gudio,

Thanks for your posting and using Aspose.Cells for GridWeb.

I tested your first issue related to webworksheets getting 0 but was unable to replicate it. However, I noticed some different issue. When the new file is loaded with import excel file method, it shows the worksheets count of previously loaded workbook.

Could you please provide me seteditablerange which works with previous version? I will test the code with latest version and in case of some error, I will log it in our database for a fix.

Thanks for your cooperation.

yes, indeed, the problem I was seeing was because webworksheets is not properly updated.

Seteditablerange works properly, it is the update of webworksheets that is the problem.
If you could raise this as an issue and get it fixed in the next version - that would be great.

guido

Hi Guido,

Thanks for using Aspose.Cells for GridWeb.

I have attached the sample web project that illustrates this issue. WebWorksheets are not updated after calling GridWeb.ImportExcelFile method.

When you run this project and click the buttons, you will see the count of web worksheets are not correct sometime

I have also attached all the source Excel files used in this project.

We have logged this issue in our database for investigation. We will look into it and fix this issue. Once, the issue is resolved or we have some other update for you, we will let you know asap.

This issue has been logged as

  • CELLSNET-43195 - WebWorksheets are not updated after calling GridWeb.ImportExcelFile

Hi,

GuidoDeBouver:
yes, indeed, the problem I was seeing was because webworksheets is not properly updated.
Seteditablerange works properly, it is the update of webworksheets that is the problem.
If you could raise this as an issue and get it fixed in the next version - that would be great.


Well, WebWorksheets and WebWorksheet classes are obsoleted, soon we are going to exclude these classes, so the internal codes behind these classes are not updated any more. Instead we provide new classes i.e., GridWorksheetCollection and GridWorksheet, so you should use the following sample code to get the updated count for the worksheets now, see the line of code for your reference:
e.g
Sample code:

.......
GridWeb1.WorkSheets.Count()

Hope this helps you a bit.

Thank you.