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

Free Support Forum - aspose.com

Applying style on cell(gridweb)



I want to change the backbolor when my I found invalid value in my java programme (using liferay portlet).
After I use cell..setStyle(style);
the cell style won't changed immediately. It will change when user input invalid value twice in a row.

flow:
1. using gridweb.setOnCellUpdatedClientFunction("dealwithcellsupdate"); to active js function.
2. dealwithcellsupdate will call ajax function post to java function to do validation.
3. setStyle part is in the "java function" on step 2.
4. the style is changed but the gridweb won't show( I know because I used getstyle to check it) but won't display immediately on the webpage.
5. it will change only when I updated the cell at the second time but I want it at the first time.

Hi,


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

Please provide us simple sample code (jsp or servlet) which we could evaluate at our end and replicate your issue.

We will also try to evaluate your issue based on your description, however, it will take some time. So, your sample code will be a good help for us. Thanks for your cooperation in this regard and have a good day.

else if ("CellModified".equalsIgnoreCase(ajaxAction)) {

GridWebBean gridweb = getgridweb(request, response);
GridWorksheetCollection gridWorksheetCollection = gridweb
.getWorkSheets();
GridWorksheet gridwebsheet = gridWorksheetCollection.get("Sheet1");
GridCells gridCells = gridwebsheet.getCells();
//For example, the original value in (3,3) is 1.
GridCell thisCell = gridCells.get(3,3).setValue(2);
data = gridCells.get(3,3).getValue();
System.out.println("Data in (3,3): "+data);
//data will return '2' as value.
//However, it won't change the value in gridweb( Show in the browser) immediately, until I call this ajax at the second time.
}

Hi,


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

Please also share some screenshots and runnable sample code. Both of them will help us replicate the issue easily and precisely. Besides, it will help us fix your issue in lesser time. Thanks for your cooperation in this regard.

Thanks for your reply but I couldn’t share the code for you at this moment.


How about I ask another question?

How to change the bgcolor of the cell immediately after user input a value.

Thank you very much.

Hi,


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

The following code sets the background (fill) color of the cell C4 of the first gridweb worksheet to Red.

Java
GridWorksheet gridSheet = gridweb.getWorkSheets().get(0);

GridCell cell = gridSheet.getCells().get(“C4”);

GridTableItemStyle style = cell.getStyle();
style.setForeColor(Color.getRed());
//style.setBackColor(Color.getRed()); //try this one too if fore color does not work
cell.setStyle(style);

However, if using gridweb,

and want the color changed immediately.
I must place your code inside a cellEventHandler.
But I want to place the code in ajax function. (However, it won’t change the fill color immediately)


Hi,


Thanks for your posting and using Aspose.Cells for GridWeb (Java).

Please spare us some time, we will look into this query and get back to you asap.

Hi,


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

I have created one page (i.e. JSP page) of GridWeb form that loads the source Excel file and displays it in Web Browser.

Here is a brief description of its contents.

file —> it contains sampleExcel.xlsx file that GridWeb will display.
grid/acw_client --> this is GridWeb directory that contains client side scripting code and part of it.
WEB-INF/lib --> this contains latest version of Aspose.Cells.GridWeb for Java.
SamplePage.jsp -->this is the JSP page that will load sample Excel file in GridWeb.

Please download the SampleGridWebJSP.rar file and extract its contents in Tomcat webapps directory and run it. The screenshots show how it will look like when you will be able to run it successfully.

Now modify this simplified GridWeb program as per your needs and it should help you deal with your original issue by experimenting with it. If you are still unable to resolve your issue, then please provide us modified SamplePage.jsp (as well as your Excel files if there is any) and some screenshots that could help us understand your issue better.

Please note, we asked you to provide us sample code but you did not provide it, so now you can use SamplePage.jsp as a template and provide us your sample code. We are afraid, we cannot help you without sample code and without your Excel files and screenshots.

Thanks for your understanding and have a good day.