Free Support Forum - aspose.com

Text align in gridweb

How can I configure the gridweb so that the content of all cells are right-align in the cell
instead of the default left-alignment?

Hi,

May the following sample code help you for your need, kindly consult it.

TableItemStyle style = new TableItemStyle();
style.HorizontalAlign = HorizontalAlign.Right;

for(int i = 1; i <= GridWeb1.WebWorksheets[0].Cells.MaxRow; i++)
{
for(int j = 0; j <= GridWeb1.WebWorksheets[0].Cells.MaxColumn; j++)
{
WebCell cell = GridWeb1.WebWorksheets[0].Cells[i,j];
cell.Style.CopyFrom(style);
}
}

Thank you.