Aspose Cells .NET Gridview


#1

I have a question regarding aspose cells for gridview .NET I am trying to implement a worksheet with data validations and formulas already set from the template. From what I read it should import automatically with the file import into gridview. I have done that but that does not happen and it seems that on every change to a cell I perform there is a postback being performed. Please help if I missing anything I believe the aspose .net total package will be great for my company.


#2

@demetri.clark,

Thanks for your query.

I guess you are using Aspose.Cells.GridWeb control - An independent Asp.Net grid control used to view or import MS Excel file formats. Also, you can design/create, update or render/save MS Excel spreadsheet with your desired formattings/style and other features. You can also set formulas and calculate formulas at runtime.

Could you elaborate your issue with more details and samples, so we could understand and help you better.

We also recommend you to kindly go through the Aspose.Cells.GridWeb Docs (see documents with examples in sections/sub-sections) for your reference:
https://docs.aspose.com/display/cellsnet/Aspose.Cells.GridWeb

Also, you may download the samples (ready to use project (examples)) here:

Hope, this helps a bit.


#3

Thank You for your prompt response. Yes I have looked at the examples. My question is so the excel sheet I have uploaded contain a simple formula. It sums the columns A1:A4 into A5. After I import it into webgrid control it does not change the value in A5 once I change any values in A1:A4. Does the webgrid control behave like that similar to excel?

KNA.zip (279.8 KB)


#4

@demetri.clark,

Thanks for the template file.

Yes, Aspose.Cells.GridWeb mostly behaves like Ms Excel. I am afraid, I could not spot the formula into the worksheet cells (e.g where “It sums the columns A1:A4 into A5”) browsing different sheets (there are many hidden sheets in the workbook). We appreciate if you could create a simple sample VS.NET project (runnable) using Aspose.Cells.GridWeb v19.8 with its latest resource files (in the “.\acw_client” folder at your installation directory), zip the project with template file(s) and post us to show the issue, we will check it soon.


#5

I apologize I uploaded the wrong workbook. This is the correct one
Test.zip (7.8 KB)


#6

Here is the project here
I removed some folder for size
AsposeDemo.zip (421.1 KB)


#7

@demetri.clark,
I have checked the behaviour of GridWeb and observed that it does not calculate the formula automatically similar to Excel. You have to call the Calculate Formula() explicitly. Please download the sample project and modify the following class to load your sample file.

public partial class ImportExportFile : System.Web.UI.Page

Once done run the project and press load button to view your file. Here you can see that after changing the data you have to press (tick) button to update the formula.

Hence it is not possible for this control to update formula and you have to call the CalculateFormula() function yourself.
ImportExportFile.PNG (48.4 KB)


#8

@demetri.clark,

I simply used the Github example project (the link is shared by Ahsan Iqbal) and updated his mentioned class file ("\GridWebBasics\ImportExportFile.aspx.cs") to include your code a bit as following. I used your template file to be imported into GridWeb matrix and it works as expected. I do not have to click on calculate/recalculate formula icon/button. I did use Aspose.Cells.GridWeb v19.8 with its latest resource files (acw_client):
e.g
Sample code:

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Aspose.Cells.GridWeb;
using Aspose.Cells.GridWeb.Data;

namespace Aspose.Cells.GridWeb.Examples.CSharp.GridWebBasics
{
    public partial class ImportExportFile : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            // If first visit this page clear GridWeb1 
            if (!IsPostBack && !GridWeb1.IsPostBack)
            {
                GridWeb1.WorkSheets.Clear();
                GridWeb1.WorkSheets.Add();
                LoadData();
            }
        }
         
        private void LoadData()
        {
            // License li = new  License();
            // li.SetLicense(@"D:\grid_project\ZZZZZZ_release_version\Aspose.Total.20141214.lic");

            // ExStart:LoadExcelFile
            // Gets the web application's path.
            string path = (this.Master as Site).GetDataDir();

            //string fileName = path + "\\GridWebBasics\\SampleData.xls";

            string fileName = "E:\\test2\\gridview\\Test.xlsx";

            // Imports from an excel file.
            GridWeb1.ImportExcelFile(fileName);
            // ExEnd:LoadExcelFile

        GridWeb1.EditMode = true;
        GridWeb1.SessionMode = SessionMode.Session;
        GridWeb1.EnableAsync = true;
        GridWorksheet sheet = GridWeb1.WorkSheets[0];

        GridWeb1.WorkSheets.ActiveSheetIndex = 0;

        GridWeb1.WebWorksheets.RunAllFormulas();
        }

        // Handles the load file button click event and load an excel file from disk
        protected void btnLoadExcelFile_Click(object sender, EventArgs e)
        {
            LoadData();
        }

        protected void GridWeb1_SaveCommand(object sender, EventArgs e)
        {
            // ExStart:SaveExcelFile
            // Generates a temporary file name.
            string filename = Session.SessionID + "_out.xls";

            string path = (this.Master as Site).GetDataDir() + "\\GridWebBasics\\";

            // Saves to the file.
            this.GridWeb1.SaveToExcelFile(path + filename);

            // Sents the file to browser.
            Response.ContentType = "application/vnd.ms-excel";
            Response.AddHeader("content-disposition", "attachment; filename=" + filename);
            Response.WriteFile(path + filename);
            Response.End();      
            // ExEnd:SaveExcelFile
        }     
    }
}

Please note, I am using Google chrome, which browser type your are using?

See the attached demo video (captured) for your reference (you can see the formula is calculated instantly once I change the value in the source cells and click on other cell or press enter).
files1.zip (971.8 KB)


#9

Hello,

Yes I am using Google Chrome as well. I have converted your code into my project and I have the save functionality working but still no luck with the formula running as well. I have confirmed that my dll’s are the latest Aspose v19.8. I am using Vb.net. It seems once I change change a value and hit enter a blue spinner appears in the lower right corner. I have attached a video and my project.


#10

Asposevid.zip (85.9 KB)
AsposeDemo.aspx.zip (1.7 KB)
I have attached the video and attached the files with my code in it. Please let me see if I am doing anything incorrectly.

Also thank you for your prompt responses. My team will be very interested in the product and hopefully will purchase the Site OEM license


#11

@demetri.clark,

Thanks for the demo video and source files.

Could you create a simple sample VS.NET project (runnable) using Aspose.Cells.GridWeb v19.8.x, zip the project with all the files and upload to some file sharing service (e.g Dropbox, Google drive, etc.) and share the Download link, we will directly download the project and run it (by opening the project into VS.NET) if we could see the issue.


#12

I have provided that here


#13

@demetri.clark,
Thank you for providing the sample project. Please spare us little time to establish the environment for this project and test it here. We will analyse it in detail and share our feedback soon.


#14

@ahsaniqbalsidiqui thank you very much


#15

@demetri.clark,

I tested your sample project using the template file. I reproduced the issue using your sample project with sample file. I found the GridWeb imports the file fine and it sums the columns A1,A4 into A5 (I tested it on Windows 10, IIS Express, .NET Framework version v4.6.x). But once we change any value in source cells (A1, A4, etc.) it does not change the value in A5.

Previously, I used the Github example project (from Github) in VS.NET 2012 on Windows8 after updating class file ("\GridWebBasics\ImportExportFile.aspx.cs") to include your code a bit (as mentioned). I used your template file to be imported into GridWeb matrix and it works as expected as I attached the demo video. But using your sample project on windows 10, it seems once we change change a value and hit enter a blue spinner appears in the lower right corner and it keeps on spinning. It looks like an issue either with GridWeb working in Ajax mode (IIS Express) or due to some settings (which needs to updated accordingly) or something else. We have to sort it out and we will do it soon. I have logged a ticket with an id “CELLSNET-46893” for your issue. We will look into it soon.

Once we have an update on it, we will let you know.

PS. By the way, did you try testing Github Examples project (after downloading it) and how it goes?


#16

@amjad_sahi1 Thank you again. And I will try running that and let you know how it goes. Please keep me updated when you can I have to get a working demo by Friday to stay with this tool. And again thank you for your help. I will try to run the github in C# first


#17

@demetri.clark,

Sure, we will keep you updated on the status of issue. We will try to figure it out soon.


#18

Also I notice I am getting this error in the DevTools F12 after I make a change in the cell:

acwmain.js:356 Uncaught TypeError: Cannot read property ‘selectNodes’ of null
at HTMLDivElement.ajaxcallback (acwmain.js:356)
at XMLHttpRequest.ajaxXmlHttp.onreadystatechange (acwmain.js:351)


#19

@demetri.clark,

Thanks for pointing it out.

I have logged it against your existing ticket “CELLSNET-46893” as well into our database. We will evaluate it soon.


#20

Thank You. Also is their any expected timeline with ticket CELLSNET-46893?