setFormatName

sets a format for a cell

void setFormatName(number rowId,number columnId,string name, [string page] );
rowIdnumberthe row id
columnIdnumberthe column id
namestringthe name of the format
pagestringoptional, the name of the sheet

Example

var name = $$("ssheet").addFormat("[green]0.0");
$$("ssheet").setFormatName(1, 1, name);

Related samples

Details

Default number formats have predefined names:

  • price - for the Currency format;
  • int - for the Number format;
  • percent - for the Percent format;
  • date - for the Date format;
  • string - for the Text format.
$$("ssheet").setFormatName(3, 1, "price");
$$("ssheet").setFormatName(5, 1, "date");

When a new column or row is added, new cells inherit the existing formats in the following way:

  • on adding a new row/rows, new cells inherit the format from the cells of the above row
  • on adding a new column/columns, new cells inherit the format from the cells of the column to the left
See also
Back to top