[]
        
首页
开发者学堂
文档
论坛
市场
生态机会
活动
在线咨询 立即试用
(Showing Draft Content)

GC.Spread.Sheets.FloatingObjects.Picture

Class: Picture

Sheets.FloatingObjects.Picture

Hierarchy

Table of contents

Constructors

Properties

Methods

Constructors

constructor

• new Picture(name, src, x, y, width, height)

表示一个图片。

Parameters

Name Type Description
name string 图片的名称。
src string 图片的图像源。
x number 图片的 x 坐标位置。
y number 图片的 y 坐标位置。
width number 图片的宽度。
height number 图片的高度。

Overrides

FloatingObject.constructor

Properties

typeName

• typeName: string

表示用于支持序列化的类型名称字符串。

example

var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject('floatingObject', 10, 10, 64, 30);
console.log(customFloatingObject.typeName); // "0"

Inherited from

FloatingObject.typeName

Methods

allowMove

▸ allowMove(value?): any

获取或设置是否禁用移动浮动对象。

example

//此示例禁止移动或调整浮动对象大小。
var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject("f1", 10, 10, 60, 64);
var btn = document.createElement('button');
btn.style.width = "60px";
btn.style.height = "30px";
btn.innerText = "button";
customFloatingObject.allowResize(false);
customFloatingObject.allowMove(false);
customFloatingObject.content(btn);
activeSheet.floatingObjects.add(customFloatingObject);

Parameters

Name Type Description
value? boolean 是否禁用移动浮动对象的设置。

Returns

any

如果未设置值,则返回是否禁用移动浮动对象的设置;否则返回浮动对象。

Inherited from

FloatingObject.allowMove


allowResize

▸ allowResize(value?): any

获取或设置是否禁用调整浮动对象大小。

example

//此示例禁止移动或调整浮动对象大小。
var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject("f1", 10, 10, 60, 64);
var btn = document.createElement('button');
btn.style.width = "60px";
btn.style.height = "30px";
btn.innerText = "button";
customFloatingObject.allowResize(false);
customFloatingObject.allowMove(false);
customFloatingObject.content(btn);
activeSheet.floatingObjects.add(customFloatingObject);

Parameters

Name Type Description
value? boolean 是否禁用调整浮动对象大小的设置。

Returns

any

如果未设置值,则返回是否禁用调整浮动对象大小的设置;否则返回浮动对象。

Inherited from

FloatingObject.allowResize


alt

▸ alt(value?): any

获取或设置浮动对象的替代文本(用于屏幕阅读器)。

example

var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject('f1', 10, 10, 60, 64);
var btn = document.createElement('button');
btn.style.width = "60px";
btn.style.height = "30px";
btn.innerText = "button";
customFloatingObject.content(btn);
customFloatingObject.alt("一个按钮");
activeSheet.floatingObjects.add(customFloatingObject);

Parameters

Name Type Description
value? string 浮动对象的替代文本。

Returns

any

浮动对象的替代文本。

Inherited from

FloatingObject.alt


backColor

▸ backColor(value?): any

获取或设置图片的背景颜色。

example

//此示例设置图片的背景颜色。
var picture = activeSheet.pictures.add("f2","Event.png",50,50,100,100);
picture.borderStyle("solid");
picture.borderWidth(2);
picture.borderColor("red");

Parameters

Name Type Description
value? string 图片的背景颜色。

Returns

any

如果未设置值,则返回图片的背景颜色;否则返回图片。


borderColor

▸ borderColor(value?): any

获取或设置图片的边框颜色。

example

//此示例设置图片的边框颜色。
var picture = activeSheet.pictures.add("f2","Event.png",50,50,100,100);
picture.borderStyle("solid");
picture.borderWidth(2);
picture.borderColor("red");

Parameters

Name Type Description
value? string 图片的边框颜色。

Returns

any

如果未设置值,则返回图片的边框颜色;否则返回图片。


borderRadius

▸ borderRadius(value?): any

获取或设置图片的边框圆角。

example

//此示例使用borderRadius方法。
var picture = activeSheet.pictures.add("f2","Event.png",50,50,100,100);
picture.backColor("blue");
picture.borderWidth(2);
picture.borderColor("red");
picture.borderStyle("dotted");
picture.borderRadius(5);

Parameters

Name Type Description
value? number 图片的边框圆角。

Returns

any

如果未设置值,则返回图片的边框圆角;否则返回图片。


borderStyle

▸ borderStyle(value?): any

获取或设置图片的边框样式。

example

//此示例使用 borderStyle 方法。
var picture = activeSheet.pictures.add("f2","Event.png",50,50,100,100);
picture.borderStyle("dotted");
picture.borderWidth(2);
picture.borderColor("red");

Parameters

Name Type Description
value? string 图片的 CSS 边框样式,例如 dotted、dashed、solid 等。

Returns

any

如果未设置值,则返回图片的边框样式;否则返回图片。


borderWidth

▸ borderWidth(value?): any

获取或设置图片的边框宽度。

example

//此示例使用 borderWidth 方法。
var picture = activeSheet.pictures.add("f2","Event.png",50,50,100,100);
picture.borderStyle("solid");
picture.borderWidth(2);
picture.borderColor("red");

Parameters

Name Type Description
value? number 图片的边框宽度。

Returns

any

如果未设置值,则返回图片的边框宽度;否则返回图片。


cloneContent

▸ cloneContent(): HTMLElement

获取实例当前内容的副本。

example

var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject('f1', 10, 10, 64, 30);
customFloatingObject.content(createButton('button 1', '64px', '30px'));
activeSheet.floatingObjects.add(customFloatingObject);

var btn = customFloatingObject.cloneContent();
btn.innerText = 'button 2';
customFloatingObject.content(btn);

function createButton (text, width, height) {
    var btn = document.createElement('button');
    btn.style.width = width;
    btn.style.height = height;
    btn.innerText = text;
    return btn;
}

Returns

HTMLElement

实例当前内容的副本。

Inherited from

FloatingObject.cloneContent


content

▸ content(value?): any

获取或设置自定义浮动对象的内容。

example

var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject('f1', 10, 10, 64, 30);
customFloatingObject.content(createButton('button 1', '64px', '30px'));
activeSheet.floatingObjects.add(customFloatingObject);

console.log(customFloatingObject.content()); // 获取当前内容,结果是文本为"button 1"的按钮元素。
customFloatingObject.content(createButton('button 2', '64px', '30px')); // 设置新内容。

function createButton (text, width, height) {
    var btn = document.createElement('button');
    btn.style.width = width;
    btn.style.height = height;
    btn.innerText = text;
    return btn;
}

Parameters

Name Type Description
value? HTMLElement 自定义浮动对象的内容。

Returns

any

如果未设置值,则返回自定义浮动对象的内容;否则返回浮动对象。

Inherited from

FloatingObject.content


dynamicMove

▸ dynamicMove(value?): any

获取或设置当隐藏或显示、调整大小或移动行或列时,对象是否移动。

example

//此示例创建一个浮动对象。
var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject("f1", 10, 10, 60, 64);
customFloatingObject.isVisible(true);
customFloatingObject.dynamicSize(true);
customFloatingObject.dynamicMove(true);
var btn = document.createElement('button');
btn.style.width = "60px";
btn.style.height = "30px";
btn.innerText = "button";
customFloatingObject.content(btn);
activeSheet.floatingObjects.add(customFloatingObject);

Parameters

Name Type Description
value? boolean 指示当隐藏或显示、调整大小或移动行或列时,对象是否移动的值。

Returns

any

如果未设置值,则返回此浮动对象是否动态移动;否则返回浮动对象。

Inherited from

FloatingObject.dynamicMove


dynamicSize

▸ dynamicSize(value?): any

获取或设置当隐藏或显示、调整大小或移动行或列时,对象的大小是否改变。

example

//此示例创建一个浮动对象。
var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject("f1", 10, 10, 60, 64);
customFloatingObject.isVisible(true);
customFloatingObject.dynamicSize(true);
customFloatingObject.dynamicMove(true);
var btn = document.createElement('button');
btn.style.width = "60px";
btn.style.height = "30px";
btn.innerText = "button";
customFloatingObject.content(btn);
activeSheet.floatingObjects.add(customFloatingObject);

Parameters

Name Type Description
value? boolean 指示当隐藏或显示、调整大小或移动行或列时,对象的大小是否改变的值。

Returns

any

如果未设置值,则返回此浮动对象是否动态改变大小;否则返回浮动对象。

Inherited from

FloatingObject.dynamicSize


endColumn

▸ endColumn(value?): any

获取或设置浮动对象位置的结束列索引。

example

//创建一个浮动对象。
var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject("f1", 10, 10, 60, 64);
var btn = document.createElement('button');
btn.style.width = "60px";
btn.style.height = "30px";
btn.innerText = "button";
customFloatingObject.content(btn);
activeSheet.floatingObjects.add(customFloatingObject);
//通过单元格锚点定位浮动对象的左上角。
customFloatingObject.startRow(2);
customFloatingObject.startColumn(2);
customFloatingObject.startRowOffset(10);
customFloatingObject.startColumnOffset(10);
//通过单元格锚点定位浮动对象的右下角。
customFloatingObject.endRow(7);
customFloatingObject.endColumn(5);
customFloatingObject.endRowOffset(10);
customFloatingObject.endColumnOffset(10);

Parameters

Name Type Description
value? number 浮动对象位置的结束列索引。

Returns

any

如果未设置值,则返回浮动对象位置的结束列索引;否则返回浮动对象。

Inherited from

FloatingObject.endColumn


endColumnOffset

▸ endColumnOffset(value?): any

获取或设置浮动对象相对于结束列的偏移量。

example

//创建一个浮动对象。
var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject("f1", 10, 10, 60, 64);
var btn = document.createElement('button');
btn.style.width = "60px";
btn.style.height = "30px";
btn.innerText = "button";
customFloatingObject.content(btn);
activeSheet.floatingObjects.add(customFloatingObject);
//通过单元格锚点定位浮动对象的左上角。
customFloatingObject.startRow(2);
customFloatingObject.startColumn(2);
customFloatingObject.startRowOffset(10);
customFloatingObject.startColumnOffset(10);
//通过单元格锚点定位浮动对象的右下角。
customFloatingObject.endRow(7);
customFloatingObject.endColumn(5);
customFloatingObject.endRowOffset(10);
customFloatingObject.endColumnOffset(10);

Parameters

Name Type Description
value? number 浮动对象相对于结束列的偏移量。

Returns

any

如果未设置值,则返回浮动对象相对于结束列的偏移量;否则返回浮动对象。

Inherited from

FloatingObject.endColumnOffset


endRow

▸ endRow(value?): any

获取或设置浮动对象位置的结束行索引。

example

//创建一个浮动对象。
var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject("f1", 10, 10, 60, 64);
var btn = document.createElement('button');
btn.style.width = "60px";
btn.style.height = "30px";
btn.innerText = "button";
customFloatingObject.content(btn);
activeSheet.floatingObjects.add(customFloatingObject);
//通过单元格锚点定位浮动对象的左上角。
customFloatingObject.startRow(2);
customFloatingObject.startColumn(2);
customFloatingObject.startRowOffset(10);
customFloatingObject.startColumnOffset(10);
//通过单元格锚点定位浮动对象的右下角。
customFloatingObject.endRow(7);
customFloatingObject.endColumn(5);
customFloatingObject.endRowOffset(10);
customFloatingObject.endColumnOffset(10);

Parameters

Name Type Description
value? number 浮动对象位置的结束行索引。

Returns

any

如果未设置值,则返回浮动对象位置的结束行索引;否则返回浮动对象。

Inherited from

FloatingObject.endRow


endRowOffset

▸ endRowOffset(value?): any

获取或设置相对于浮动对象结束行的偏移量。

example

//创建一个浮动对象。
var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject("f1", 10, 10, 60, 64);
var btn = document.createElement('button');
btn.style.width = "60px";
btn.style.height = "30px";
btn.innerText = "button";
customFloatingObject.content(btn);
activeSheet.floatingObjects.add(customFloatingObject);
//通过单元格锚点定位浮动对象的左上角。
customFloatingObject.startRow(2);
customFloatingObject.startColumn(2);
customFloatingObject.startRowOffset(10);
customFloatingObject.startColumnOffset(10);
//通过单元格锚点定位浮动对象的右下角。
customFloatingObject.endRow(7);
customFloatingObject.endColumn(5);
customFloatingObject.endRowOffset(10);
customFloatingObject.endColumnOffset(10);

Parameters

Name Type Description
value? number 相对于浮动对象结束行的偏移量。

Returns

any

如果未设置值,则返回相对于浮动对象结束行的偏移量;否则返回浮动对象。

Inherited from

FloatingObject.endRowOffset


fixedPosition

▸ fixedPosition(value): any

获取或设置浮动对象的位置是否固定。当 fixedPosition 为 true 时,dynamicMove 和 dynamicSize 将被禁用。

example

//此示例将对象的位置设置为固定。
var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject("f1", 10, 10, 60, 64);
customFloatingObject.fixedPosition(true);
var btn = document.createElement('button');
btn.style.width = "60px";
btn.style.height = "30px";
btn.innerText = "button";
customFloatingObject.content(btn);
activeSheet.floatingObjects.add(customFloatingObject);

Parameters

Name Type
value boolean

Returns

any

如果未设置值,则返回浮动对象的位置是否固定;否则返回浮动对象。

Inherited from

FloatingObject.fixedPosition


getHost

▸ getHost(): HTMLElement[]

获取自定义内容的DOM宿主。

Returns

HTMLElement[]

Inherited from

FloatingObject.getHost


getOriginalHeight

▸ getOriginalHeight(): number

获取图片的原始高度。

example

activeSheet.pictures.add("f2","Event.png",2,2,6,6);
activeSheet.pictures.add("f1","tsoutline.png",3,0,6,6);
var picture = activeSheet.pictures.get("f2");
picture.pictureStretch(GC.Spread.Sheets.ImageLayout.center);
//button
$("#button1").click(function () {
  alert(picture.getOriginalHeight());
});

Returns

number

图片的原始高度。


getOriginalWidth

▸ getOriginalWidth(): number

获取图片的原始宽度。

example

activeSheet.pictures.add("f2","Event.png",2,2,6,6);
activeSheet.pictures.add("f1","tsoutline.png",3,0,6,6);
var picture = activeSheet.pictures.get("f2");
picture.pictureStretch(GC.Spread.Sheets.ImageLayout.center);
//button
$("#button1").click(function () {
     alert(picture.getOriginalWidth());
});

Returns

number

图片的原始宽度。


height

▸ height(value?): any

获取或设置浮动对象的高度。

example

//此示例创建一个浮动对象。
var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject("f1");
customFloatingObject.x(10);
customFloatingObject.y(10);
customFloatingObject.width(60);
customFloatingObject.height(64);
var btn = document.createElement('button');
btn.style.width = "60px";
btn.style.height = "30px";
btn.innerText = "button";
customFloatingObject.content(btn);
activeSheet.floatingObjects.add(customFloatingObject);

Parameters

Name Type Description
value? number 浮动对象的高度。

Returns

any

如果未设置值,则返回浮动对象的高度;否则返回浮动对象。

Inherited from

FloatingObject.height


isLocked

▸ isLocked(value?): any

获取或设置此浮动对象是否被锁定。

example

var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject("f1");
customFloatingObject.x(10);
customFloatingObject.y(10);
customFloatingObject.width(60);
customFloatingObject.height(64);
customFloatingObject.isLocked(true);
var btn = document.createElement('button');
btn.style.width = "60px";
btn.style.height = "30px";
btn.innerText = "button";
customFloatingObject.content(btn);
activeSheet.floatingObjects.add(customFloatingObject);
activeSheet.options.isProtected = true;

Parameters

Name Type Description
value? boolean 指示此浮动对象是否被锁定的值。

Returns

any

如果未设置值,则返回此浮动对象是否被锁定;否则返回浮动对象。

Inherited from

FloatingObject.isLocked


isSelected

▸ isSelected(value?): any

获取或设置此浮动对象是否被选中。

example

//此示例创建一个浮动对象。
var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject("f1", 10, 10, 60, 64);
customFloatingObject.isSelected(true);
var btn = document.createElement('button');
btn.style.width = "60px";
btn.style.height = "30px";
btn.innerText = "button";
customFloatingObject.content(btn);
activeSheet.floatingObjects.add(customFloatingObject);

Parameters

Name Type Description
value? boolean 指示此浮动对象是否被选中的值。

Returns

any

如果未设置值,则返回此浮动对象是否被选中;否则返回浮动对象。

Inherited from

FloatingObject.isSelected


isVisible

▸ isVisible(value?): any

获取或设置此浮动对象是否可见。

example

//此示例创建一个浮动对象。
var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject("f1", 10, 10, 60, 64);
customFloatingObject.isVisible(true);
customFloatingObject.dynamicSize(true);
customFloatingObject.dynamicMove(true);
var btn = document.createElement('button');
btn.style.width = "60px";
btn.style.height = "30px";
btn.innerText = "button";
customFloatingObject.content(btn);
activeSheet.floatingObjects.add(customFloatingObject);

Parameters

Name Type Description
value? boolean 指示此浮动对象是否可见的值。

Returns

any

如果未设置值,则返回此浮动对象是否可见;否则返回浮动对象。

Inherited from

FloatingObject.isVisible


name

▸ name(value?): any

获取浮动对象的名称。

example

//此示例使用name方法。
var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject();
customFloatingObject.name("f1");
customFloatingObject.x(10);
customFloatingObject.y(10);
customFloatingObject.width(60);
customFloatingObject.height(64);
var btn = document.createElement('button');
btn.style.width = "60px";
btn.style.height = "30px";
btn.innerText = "button";
customFloatingObject.content(btn);
activeSheet.floatingObjects.add(customFloatingObject);

Parameters

Name Type Description
value? string 浮动对象的名称。

Returns

any

如果未设置值,则返回浮动对象的名称;否则返回浮动对象。

Inherited from

FloatingObject.name


pictureStretch

▸ pictureStretch(value?): any

获取或设置图片的拉伸方式。

example

//此示例使用pictureStretch方法。
var picture = activeSheet.pictures.add("f2","Event.png",50,50,100,100);
picture.pictureStretch(GC.Spread.Sheets.ImageLayout.stretch);
picture.backColor("blue");

Parameters

Name Type Description
value? ImageLayout 图片的拉伸方式。

Returns

any

如果未设置值,则返回图片的拉伸方式;否则返回图片。


refreshContent

▸ refreshContent(): void

刷新浮动对象中的内容。用户应该重写此方法以使其内容与浮动对象保持同步。

example

var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject('floatingObject', 10, 10, 64, 30);
var btn = document.createElement('button');
btn.style.width = "60px";
btn.style.height = "30px";
btn.innerText = "button";
customFloatingObject.content(btn);
// 隐藏浮动对象
customFloatingObject.isVisible(false);
activeSheet.floatingObjects.add(customFloatingObject);

// 显示浮动对象
customFloatingObject.isVisible(true);
customFloatingObject.refreshContent(customFloatingObject.content());

Returns

void

Inherited from

FloatingObject.refreshContent


src

▸ src(value?): any

获取或设置图片的源地址。

example

var pic = sheet.pictures.add("Picture 1", "Event.png", 100, 50, 200, 200);
var src = pic.src(); // 获取当前图片源,结果为"Event.png"。
pic.src("tsoutline.png"); // 设置新的图片源。

Parameters

Name Type Description
value? string 图片的源地址。

Returns

any

如果未设置值,则返回图片的源地址;否则返回图片。


startColumn

▸ startColumn(value?): any

获取或设置浮动对象位置的起始列索引。

example

//创建一个浮动对象。
var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject("f1", 10, 10, 60, 64);
var btn = document.createElement('button');
btn.style.width = "60px";
btn.style.height = "30px";
btn.innerText = "button";
customFloatingObject.content(btn);
activeSheet.floatingObjects.add(customFloatingObject);
//通过单元格锚点定位浮动对象的左上角。
customFloatingObject.startRow(2);
customFloatingObject.startColumn(2);
customFloatingObject.startRowOffset(10);
customFloatingObject.startColumnOffset(10);

Parameters

Name Type Description
value? number 浮动对象位置的起始列索引。

Returns

any

如果未设置值,则返回浮动对象位置的起始列索引;否则返回浮动对象。

Inherited from

FloatingObject.startColumn


startColumnOffset

▸ startColumnOffset(value?): any

获取或设置浮动对象相对于起始列的偏移量。

example

//创建一个浮动对象。
var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject("f1", 10, 10, 60, 64);
var btn = document.createElement('button');
btn.style.width = "60px";
btn.style.height = "30px";
btn.innerText = "button";
customFloatingObject.content(btn);
activeSheet.floatingObjects.add(customFloatingObject);
//通过单元格锚点定位浮动对象的左上角。
customFloatingObject.startRow(2);
customFloatingObject.startColumn(2);
customFloatingObject.startRowOffset(10);
customFloatingObject.startColumnOffset(10);

Parameters

Name Type Description
value? number 浮动对象相对于起始列的偏移量。

Returns

any

如果未设置值,则返回浮动对象相对于起始列的偏移量;否则返回浮动对象。

Inherited from

FloatingObject.startColumnOffset


startRow

▸ startRow(value?): any

获取或设置浮动对象位置的起始行索引。

example

//创建一个浮动对象。
var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject("f1", 10, 10, 60, 64);
var btn = document.createElement('button');
btn.style.width = "60px";
btn.style.height = "30px";
btn.innerText = "button";
customFloatingObject.content(btn);
activeSheet.floatingObjects.add(customFloatingObject);
//通过单元格锚点定位浮动对象的左上角。
customFloatingObject.startRow(2);
customFloatingObject.startColumn(2);
customFloatingObject.startRowOffset(10);
customFloatingObject.startColumnOffset(10);

Parameters

Name Type Description
value? number 浮动对象位置的起始行索引。

Returns

any

如果未设置值,则返回浮动对象位置的起始行索引;否则返回浮动对象。

Inherited from

FloatingObject.startRow


startRowOffset

▸ startRowOffset(value?): any

获取或设置浮动对象相对于起始行的偏移量。

example

//此示例创建一个浮动对象。
var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject("f1", 10, 10, 60, 64);
var btn = document.createElement('button');
btn.style.width = "60px";
btn.style.height = "30px";
btn.innerText = "button";
customFloatingObject.content(btn);
activeSheet.floatingObjects.add(customFloatingObject);
//通过单元格锚点定位浮动对象的左上角。
customFloatingObject.startRow(2);
customFloatingObject.startColumn(2);
customFloatingObject.startRowOffset(10);
customFloatingObject.startColumnOffset(10);

Parameters

Name Type Description
value? number 浮动对象相对于起始行的偏移量。

Returns

any

如果未设置值,则返回浮动对象相对于起始行的偏移量;否则返回浮动对象。

Inherited from

FloatingObject.startRowOffset


width

▸ width(value?): any

获取或设置浮动对象的宽度。

example

//此示例创建一个浮动对象。
var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject("f1");
customFloatingObject.x(10);
customFloatingObject.y(10);
customFloatingObject.width(60);
customFloatingObject.height(64);
var btn = document.createElement('button');
btn.style.width = "60px";
btn.style.height = "30px";
btn.innerText = "button";
customFloatingObject.content(btn);
activeSheet.floatingObjects.add(customFloatingObject);

Parameters

Name Type Description
value? number 浮动对象的宽度。

Returns

any

如果未设置值,则返回浮动对象的宽度;否则返回浮动对象。

Inherited from

FloatingObject.width


x

▸ x(value?): any

获取或设置浮动对象的水平位置。

example

//此示例创建一个浮动对象。
var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject("f1");
customFloatingObject.x(10);
customFloatingObject.y(10);
customFloatingObject.width(60);
customFloatingObject.height(64);
var btn = document.createElement('button');
btn.style.width = "60px";
btn.style.height = "30px";
btn.innerText = "button";
customFloatingObject.content(btn);
activeSheet.floatingObjects.add(customFloatingObject);

Parameters

Name Type Description
value? number 浮动对象的水平位置。

Returns

any

如果未设置值,则返回浮动对象的水平位置;否则返回浮动对象。

Inherited from

FloatingObject.x


y

▸ y(value?): any

获取或设置浮动对象的垂直位置。

example

//此示例创建一个浮动对象。
var customFloatingObject = new GC.Spread.Sheets.FloatingObjects.FloatingObject("f1");
customFloatingObject.x(10);
customFloatingObject.y(10);
customFloatingObject.width(60);
customFloatingObject.height(64);
var btn = document.createElement('button');
btn.style.width = "60px";
btn.style.height = "30px";
btn.innerText = "button";
customFloatingObject.content(btn);
activeSheet.floatingObjects.add(customFloatingObject);

Parameters

Name Type Description
value? number 浮动对象的垂直位置。

Returns

any

如果未设置值,则返回浮动对象的垂直位置;否则返回浮动对象。

Inherited from

FloatingObject.y