Aspose.Cells.GridWeb.Examples.CSharp.Miscellaneous.Format.ApplyCustomFormats.InitData C# (CSharp) Method

InitData() private method

private InitData ( ) : void
return void
        private void InitData()
        {
            GridWeb1.WorkSheets.Clear();
            GridWeb1.WorkSheets.Add("Custom Format");

            GridCell cell;
            GridCells cells = GridWeb1.WorkSheets[0].Cells;
            cells["A1"].PutValue("Custom Format");
            cells["A2"].PutValue("0.0");
            cells["A3"].PutValue("0.000");
            cells["A4"].PutValue("#,##0.0");
            cells["A5"].PutValue("0.0%");
            cells["A6"].PutValue("0.000E+00");
            cells["A7"].PutValue("yyyy-m-d h:mm");

            cell = cells["B1"];
            cell.PutValue("Format Results");

            cell = cells["B2"];
            cell.PutValue(12345.6789);
            cell.SetCustom("0.0");

            cell = cells["B3"];
            cell.PutValue(12345.6789);
            cell.SetCustom("0.000");
            
            cell = cells["B4"];
            cell.PutValue(543123456.789);
            cell.SetCustom("#,##0.0");

            cell = cells["B5"];
            cell.PutValue(0.925687);
            cell.SetCustom("0.0%");

            cell = cells["B6"];
            cell.PutValue(-1234567890.5687);
            cell.SetCustom("0.000E+00");

            cell = cells["B7"];
            cell.PutValue(DateTime.Now);
            cell.SetCustom("yyyy-m-d h:mm");

            cells.SetColumnWidthPixel(0, 220);
            cells.SetColumnWidthPixel(1, 220);
        }