Free Support Forum - aspose.com

GridWeb Background Images in Cells and Picture performance

Hi,

My company recently purchased a recent version of Aspose.Cells (v. 19.12.0.0) in order to develop an updated version of our web applications which use an older version (v. 2.7.5.2000). We essentially use the GridWeb component.

One of the very important features is the use of images in cells, as illustrated here: image.png (3.1 KB)

In the older version we achieve this by setting the BackImageUrl on the cell’s style:
TableItemStyle st = grid.WebWorksheets[PAG_MAIN].Cells[row, col].GetStyle();
st.BackImageUrl = “./Images/local_16.png”;
st.BackImageAttributes = “right|no-repeat”;
grid.WebWorksheets[PAG_MAIN].Cells[row, col].SetStyle(st);

In the current version, even though the properties are present, these do not take effect.
GridTableItemStyle st = new GridTableItemStyle();
st.BackImageUrl = “./Images/local_16.png”;
st.BackImageAttributes = “right|no-repeat”;
grid.WorkSheets[PAG_MAIN].Cells[row, col].CopyStyle(st);

The images do not appear on the cells. I would like to know if this is suppose to happen or if I need to do something for the images to appear.

I also tried using the Pictures collection which shows the images correctly. However, every time there is a postback on the page, the user needs to wait for all images to be loaded before the page becomes available again. Since we can use a lot of images this makes the page unusable.

I set the pictures in the following manner:
grid.WorkSheets[PAG_MAIN].Pictures.Add(row, col, ImagePath);

Is there a better way to do this?

I appreciate any help you could offer.

Thanks

@virginia.nascimento,

Thanks for the screenshot and details.

Could you try using the line if it makes any difference:
`grid.WorkSheets[PAG_MAIN].Cells[row, col].Style = st;

Also, we recommend you to upgrade to latest Aspose.Cells.GridWeb v20.3 with its latest resource files. If you still find any issue with latest version, we need a simulation VS.NET project (runnable) to evaluate your issue regarding style and picture postback.

Hi,

Thanks for the quick reply.
I tried using the Style property, and also updated to the most recent version. Still I have the same result.

Here is a simple project that illustrates my problem:
Sample project

I used the Style property on the first cell, and the SetStyle function on the second row. In both cases the images don’t appear.
grid.ActiveSheet.Cells[0, 0].Style = st;
grid.ActiveSheet.Cells.SetStyle(1, 0, 1, 10, st);

I then use the Pictures collection on the remaining rows. The images show, but they take some time to load.
grid.ActiveSheet.Pictures.Add(i, j, Server.MapPath("~") + @"\img\local.png");

image.png (2.2 KB)

Is there a better way to load the images?

Thanks for your help.

@virginia.nascimento,
Thank you for providing the sample project. We have observed the performance issue and we will analyze it more. Could you please share another runnable project which was working fine earlier with your previous version (before upgrading to v19.12 having old code mentioned in your first post). We want to see the behavior of previous version and compare it with the current one for our reference. Once you provide this information, we will analyze it and log appropriate tickets for all your issues.

Also please share which version of Aspose.Cells product were you using earlier.

Thank you for your help,

Here is an example with the previous version:
Sample project

We were using a very old version 2.7.5.2000 from 2012. The dll is included in this sample project.
The code for showing the images was:
Aspose.Cells.GridWeb.TableItemStyle st = grid.WebWorksheets[0].Cells[0, 0].GetStyle();
st.BackImageUrl = “./img/obs.png”;
st.BackImageAttributes = “right|no-repeat”;
grid.WebWorksheets[0].Cells[0, 0].SetStyle(st);

The image show correctly:
image.png (2.1 KB)

Both TableItemStyle and WebWorksheets classes are currently deprecated, so I am using the corresponding classes and properties on the new version.

@virginia.nascimento,
We were able to observe the issues but we need to look into them more. We have logged the issues in our database for investigation and for a fix. Once, we will have some news for you, we will update you in this topic.

This issues have been logged as

CELLSNET-47274 – Background image not set in GridWeb
CELLSNET-47275 – Slow performance while adding pictures in the active sheet of GridWeb

@virginia.nascimento,
We have investigated CELLSNET-47274 more. Setting a background picture is not supported in new version. We will support it soon.

@virginia.nascimento,
We have reviewed the performance issue logged under Id: CELLSNET-47275 and observed that its expected behavior of the API. No further improvement can be made as already best possible implementation is done to add pictures in the active sheet. Please feel free to write us back if you any other query in the regard.

@virginia.nascimento,

This is to inform you that we have fixed the issue (logged earlier as “CELLSNET-47274”) now. We will soon provide you the fixed version after performing QA and incorporating other enhancements and fixes.

@virginia.nascimento,

Please try our latest version/fix: Aspose.Cells.GridWeb v20.3.8 (attached)

Your issue “CELLSNET-47274” should be fixed in it.

Let us know your feedback.
Aspose.Cells.GridWeb.20.3.8.zip (5.2 MB)

Hi, I just tested in the sample project and the images show correctly.

Thank you for the quick response!

@virginia.nascimento,

Good to know that your issue is sorted out by the new version/fix. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.

The issues you have found earlier (filed as CELLSNET-47274) have been fixed in Aspose.Cells for .NET v20.4. This message was posted using Bugs notification tool by Amjad_Sahi