Free Support Forum - aspose.com

Setting Style property of webworksheet webcell in GridWeb using Style attribute from html

Hi,


Is there a way I can set style of WebCell in GridWeb using style attribute value from html css property?
For e.g. my style= "width: 99.6pt; padding-right: 5.4pt; padding-left: 5.4pt; vertical-align: top;
border-top-color: rgb(0, 0, 0); border-top-width: 0.5pt; border-top-style: solid;
background-color: rgb(255, 255, 0);"
Can I assign it directly to webCell set style property?

Regards
Virendra Kumar

Hi,

Well, I think you may use TableItemStyle.CssClass property for it. For example, you may add the css style into section of the Aspx page.
e.g

...................


.acwDay

{font:Arial, Helvetica, sans-serif;

color:Black;

font-weight:bold;

background-color:Yellow;

font-size:16;}


.................

Now set the css class to TableItemStyle in code behind:

i.e..,

if (!IsPostBack)

{

WebWorksheet sheet = GridWeb1.WebWorksheets[0];
WebCell cell = sheet.Cells[0,0];
cell.StringValue = "test";

Aspose.Cells.GridWeb.TableItemStyle style = cell.GetStyle();

style.CssClass = “acwDay”;

cell.SetStyle(style);

}


Thank you.

Hi,


I have style of as

I want to assign this style to webcell in my webworksheet.
Is any method is present for the same in Aspose.Cells.WebGrid?

Regards
Virendra Kumar

Hi,


I am afraid, this type of tag formatting is not supported, you have to write style’s “CSS” in the format as per my previous post via using TableItemStyle.CssClass attribute for your fonts and back/fore colors etc. options:
http://www.aspose.com/community/forums/permalink/433720/433700/showthread.aspx#433700

If you need to apply borders’ style for the cells in the Web Grid, you have to specify the borders attributes/APIs accordingly, see the documentation topic for reference:
http://www.aspose.com/docs/display/cellsnet/Formatting+Cells
See the sub-topic: “Setting Borders