Page tree
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

You can set cell padding and other style options for a watermark. You can set styles such as font, forecolor, alignment, and visibility.
Use cellPadding to set cell padding and style options.

Using Code
This example adds watermarks to cells and sets the padding and other style options.

JavaScript

Copy Code

var type = new GC.Spread.Sheets.Style();type.watermark = "User name";type.cellPadding = "20";type.labelOptions = {alignment:GC.Spread.Sheets.LabelAlignment.topLeft, visibility: GC.Spread.Sheets.LabelVisibility.visible};activeSheet.setStyle(0, 1, type);activeSheet.getRange(0, -1, 1, -1, GC.Spread.Sheets.SheetArea.viewport).height(60);activeSheet.getRange(-1, 1, -1, 1).width(150);
<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="fbeabc5e-5e7e-4a1d-ace5-4e1b54f3cbed"><ac:plain-text-body><![CDATA[var combo = new GC.Spread.Sheets.CellTypes.ComboBox();combo.items([{ text: "Oranges", value: "11k" }, { text: "Apples", value: "15k" }, { text: "Grape", value: "100k" }]);combo.editorValueType(GC.Spread.Sheets.CellTypes.EditorValueType.text);activeSheet.setCellType(2, 1, combo, GC.Spread.Sheets.SheetArea.viewport);activeSheet.getCell(2, 1, GC.Spread.Sheets.SheetArea.viewport).watermark("ComboBox Cell Type").cellPadding('10 10 20 10');activeSheet.getCell(2, 1, GC.Spread.Sheets.SheetArea.viewport).labelOptions({alignment: GC.Spread.Sheets.LabelAlignment.bottomCenter, foreColor: 'yellowgreen', font: 'bold 15px Arial'});activeSheet.getRange(2, -1, 1, -1, GC.Spread.Sheets.SheetArea.viewport).height(60);

 

]]></ac:plain-text-body></ac:structured-macro>

See Also
Style class
LabelAlignment Enumeration
LabelVisibility Enumeration
cellPadding Method
labelOptions Method

  • No labels