[]
        
(Showing Draft Content)

GC.Spread.Sheets.FloatingObjects.Picture

类: Picture

Sheets.FloatingObjects.Picture

继承关系

Table of contents

构造方法

属性

方法

构造方法

constructor

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

图片

参数

属性名 类型 说明
name string 图片名称
src string 图片的图像来源
x number 图片的x位置
y number 图片的y位置
width number 图片的宽度
height number 图片的高度

Overrides

FloatingObject.constructor

属性

typeName

typeName: string

支持序列化的类型名称字符串

继承自

FloatingObject.typeName

方法

allowMove

allowMove(value?): any

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

代码示例

//本示例阻止您移动或调整浮动对象元素的大小
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);

参数

属性名 类型 说明
value? boolean 是否禁用移动浮动对象元素的设置

返回值

any

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

继承自

FloatingObject.allowMove


allowResize

allowResize(value?): any

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

代码示例

//本示例阻止您移动或调整浮动对象元素的大小
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);

参数

属性名 类型 说明
value? boolean 是否禁用调整浮动对象大小的设置

返回值

any

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

继承自

FloatingObject.allowResize


alt

alt(value?): any

获取或设置浮动对象的可选文本

代码示例

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("A button");
activeSheet.floatingObjects.add(customFloatingObject);

参数

属性名 类型 说明
value? string 浮动对象的可选文本

返回值

any

浮动对象的可选文本

继承自

FloatingObject.alt


backColor

backColor(value?): any

获取或设置图片的背景色

代码示例

//This example sets the backcolor of the picture.
var picture = activeSheet.pictures.add("f2","Event.png",50,50,100,100);
picture.borderStyle("solid");
picture.borderWidth(2);
picture.borderColor("red");

参数

属性名 类型 说明
value? string 图片的背景色

返回值

any

如果未设置任何值,则返回图片的背景色.否则,返回图片


borderColor

borderColor(value?): any

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

代码示例

//This example sets the border color of the picture.
var picture = activeSheet.pictures.add("f2","Event.png",50,50,100,100);
picture.borderStyle("solid");
picture.borderWidth(2);
picture.borderColor("red");

参数

属性名 类型 说明
value? string 图片的边框颜色

返回值

any

如果未设置任何值,则返回图片的边框颜色.否则,返回图片


borderRadius

borderRadius(value?): any

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

代码示例

//本示例使用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);

参数

属性名 类型 说明
value? number 图片的边框圆角半径

返回值

any

如果未设置任何值,则返回图片的边框圆角半径.否则,返回图片


borderStyle

borderStyle(value?): any

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

代码示例

//This example uses the borderStyle method.
var picture = activeSheet.pictures.add("f2","Event.png",50,50,100,100);
picture.borderStyle("dotted");
picture.borderWidth(2);
picture.borderColor("red");

参数

属性名 类型 说明
value? string 图片的css边框样式,如点线,虚线,实线等

返回值

any

如果未设置任何值,则返回图片的边框样式.否则,返回图片


borderWidth

borderWidth(value?): any

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

代码示例

//This example uses the borderWidth method.
var picture = activeSheet.pictures.add("f2","Event.png",50,50,100,100);
picture.borderStyle("solid");
picture.borderWidth(2);
picture.borderColor("red");

参数

属性名 类型 说明
value? number 图片的边框宽度

返回值

any

如果未设置任何值,则返回图片的边框宽度.否则,返回图片


cloneContent

cloneContent(): HTMLElement

获取当前实例的内容副本

代码示例

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;
}

返回值

HTMLElement

当前实例内容的副本

继承自

FloatingObject.cloneContent


content

content(value?): any

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

代码示例

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()); // get current content, the result is button element with the text "button 1".
customFloatingObject.content(createButton('button 2', '64px', '30px')); // set new content.

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

参数

属性名 类型 说明
value? HTMLElement 自定义浮动对象元素的内容

返回值

any

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

继承自

FloatingObject.content


dynamicMove

dynamicMove(value?): any

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

代码示例

//本示例创建了一个浮动对象
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);

参数

属性名 类型 说明
value? boolean 该值指示对象在隐藏或显示,调整大小或移动行或列时是否移动

返回值

any

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

继承自

FloatingObject.dynamicMove


dynamicSize

dynamicSize(value?): any

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

代码示例

//本示例创建了一个浮动对象
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);

参数

属性名 类型 说明
value? boolean 该值指示在隐藏或显示,调整大小或移动行或列时对象的大小是否改变

返回值

any

如果未设置任何值,则返回此浮动对象元素是否动态更改大小;否则,返回浮动对象元素

继承自

FloatingObject.dynamicSize


endColumn

endColumn(value?): any

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

代码示例

//Creates a floating object.
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);
//Position the upper left corner of the floating object by cell anchors.
customFloatingObject.startRow(2);
customFloatingObject.startColumn(2);
customFloatingObject.startRowOffset(10);
customFloatingObject.startColumnOffset(10);
//Position the lower right corner of the floating object by cell anchors.
customFloatingObject.endRow(7);
customFloatingObject.endColumn(5);
customFloatingObject.endRowOffset(10);
customFloatingObject.endColumnOffset(10);

参数

属性名 类型 说明
value? number 浮动对象元素位置的结束列索引

返回值

any

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

继承自

FloatingObject.endColumn


endColumnOffset

endColumnOffset(value?): any

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

代码示例

//Creates a floating object.
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);
//Position the upper left corner of the floating object by cell anchors.
customFloatingObject.startRow(2);
customFloatingObject.startColumn(2);
customFloatingObject.startRowOffset(10);
customFloatingObject.startColumnOffset(10);
//Position the lower right corner of the floating object by cell anchors.
customFloatingObject.endRow(7);
customFloatingObject.endColumn(5);
customFloatingObject.endRowOffset(10);
customFloatingObject.endColumnOffset(10);

参数

属性名 类型 说明
value? number 相对于浮动对象元素的结束列的偏移量

返回值

any

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

继承自

FloatingObject.endColumnOffset


endRow

endRow(value?): any

获取或设置浮动对象元素位置的末行索引

代码示例

//Creates a floating object.
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);
//Position the upper left corner of the floating object by cell anchors.
customFloatingObject.startRow(2);
customFloatingObject.startColumn(2);
customFloatingObject.startRowOffset(10);
customFloatingObject.startColumnOffset(10);
//Position the lower right corner of the floating object by cell anchors.
customFloatingObject.endRow(7);
customFloatingObject.endColumn(5);
customFloatingObject.endRowOffset(10);
customFloatingObject.endColumnOffset(10);

参数

属性名 类型 说明
value? number 浮动对象元素位置的末行索引

返回值

any

如果未设置任何值,则返回浮动对象元素位置的末端行索引;否则,返回浮动对象元素

继承自

FloatingObject.endRow


endRowOffset

endRowOffset(value?): any

获取或设置相对于浮动对象元素的最后一行的偏移量

代码示例

//Creates a floating object.
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);
//Position the upper left corner of the floating object by cell anchors.
customFloatingObject.startRow(2);
customFloatingObject.startColumn(2);
customFloatingObject.startRowOffset(10);
customFloatingObject.startColumnOffset(10);
//Position the lower right corner of the floating object by cell anchors.
customFloatingObject.endRow(7);
customFloatingObject.endColumn(5);
customFloatingObject.endRowOffset(10);
customFloatingObject.endColumnOffset(10);

参数

属性名 类型 说明
value? number 相对于浮动对象元素的最后一行的偏移量

返回值

any

如果未设置任何值,则返回相对于浮动对象元素的最后一行的偏移量;否则,返回浮动对象元素

继承自

FloatingObject.endRowOffset


fixedPosition

fixedPosition(value): any

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

代码示例

//本示例将对象的位置设置为固定
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);

参数

属性名 类型 说明
value boolean 该值指示浮动对象元素的位置是否固定

返回值

any

如果未设置任何值,则返回浮动对象元素的位置是否固定 否则,返回浮动对象元素

继承自

FloatingObject.fixedPosition


getHost

getHost(): HTMLElement[]

获取自定义内容的dom宿主

返回值

HTMLElement[]

继承自

FloatingObject.getHost


getOriginalHeight

getOriginalHeight(): number

获取图片的原始高度

代码示例

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());
});

返回值

number

图片的原始高度


getOriginalWidth

getOriginalWidth(): number

获取图片的原始宽度

代码示例

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());
});

返回值

number

图片的原始宽度


height

height(value?): any

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

代码示例

//本示例创建了一个浮动对象
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);

参数

属性名 类型 说明
value? number 浮动对象元素的高度

返回值

any

如果未设置任何值,则返回一个浮动对象元素的高度;否则,返回浮动对象元素

继承自

FloatingObject.height


isLocked

isLocked(value?): any

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

代码示例

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;

参数

属性名 类型 说明
value? boolean 该值指示此浮动对象元素是否被锁定

返回值

any

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

继承自

FloatingObject.isLocked


isSelected

isSelected(value?): any

获取或设置是否选择此浮动对象元素

代码示例

//本示例创建了一个浮动对象
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);

参数

属性名 类型 说明
value? boolean 该值指示此浮动对象元素是否被选择

返回值

any

如果未设置任何值,则返回是否选择此浮动对象元素;否则,返回浮动对象元素

继承自

FloatingObject.isSelected


isVisible

isVisible(value?): any

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

代码示例

//本示例创建了一个浮动对象
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);

参数

属性名 类型 说明
value? boolean 该值指示此浮动对象元素是否可见

返回值

any

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

继承自

FloatingObject.isVisible


name

name(value?): any

获取浮动对象元素的名称

代码示例

//本示例使用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);

参数

属性名 类型 说明
value? string 浮动对象元素的名称

返回值

any

如果未设置任何值,则返回浮动对象元素的名称;否则,返回浮动对象元素

继承自

FloatingObject.name


pictureStretch

pictureStretch(value?): any

获取或设置图片的拉伸程度

代码示例

//This example uses the pictureStretch method.
var picture = activeSheet.pictures.add("f2","Event.png",50,50,100,100);
picture.pictureStretch(GC.Spread.Sheets.ImageLayout.stretch);
picture.backColor("blue");

参数

属性名 类型 说明
value? ImageLayout 图片的拉伸程度

返回值

any

如果未设置任何值,则返回图片的拉伸程度;否则,返回图片


refreshContent

refreshContent(): void

刷新floatObject中的内容用户应重写此方法,以使其内容与floatObject同步

返回值

void

继承自

FloatingObject.refreshContent


src

src(value?): any

获取或设置图片的src

代码示例

var pic = sheet.pictures.add("Picture 1", "Event.png", 100, 50, 200, 200);
var src = pic.src(); // get current image source, the result is "Event.png".
pic.src("tsoutline.png"); // set new image source.

参数

属性名 类型 说明
value? string 图片的src

返回值

any

如果未设置任何值,则返回图片的src 否则,返回图片


startColumn

startColumn(value?): any

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

代码示例

//Creates a floating object.
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);
//Position the upper left corner of the floating object by cell anchors.
customFloatingObject.startRow(2);
customFloatingObject.startColumn(2);
customFloatingObject.startRowOffset(10);
customFloatingObject.startColumnOffset(10);

参数

属性名 类型 说明
value? number 浮动对象元素位置的起始列索引

返回值

any

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

继承自

FloatingObject.startColumn


startColumnOffset

startColumnOffset(value?): any

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

代码示例

//本示例创建了一个浮动对象
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);

参数

属性名 类型 说明
value? number 相对于浮动对象元素的起始列的偏移量

返回值

any

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

继承自

FloatingObject.startColumnOffset


startRow

startRow(value?): any

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

代码示例

//本示例创建了一个浮动对象
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);

参数

属性名 类型 说明
value? number 动对象元素位置的起始行索引

返回值

any

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

继承自

FloatingObject.startRow


startRowOffset

startRowOffset(value?): any

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

代码示例

//本示例创建了一个浮动对象
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);

参数

属性名 类型 说明
value? number 相对于浮动对象元素的起始行的偏移量

返回值

any

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

继承自

FloatingObject.startRowOffset


width

width(value?): any

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

代码示例

//本示例创建了一个浮动对象
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);

参数

属性名 类型 说明
value? number 浮动对象元素的宽度

返回值

any

如果未设置任何值,则返回一个浮动对象元素的宽度;否则,返回浮动对象元素

继承自

FloatingObject.width


x

x(value?): any

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

代码示例

//本示例创建了一个浮动对象
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);

参数

属性名 类型 说明
value? number 浮动对象元素的水平位置

返回值

any

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

继承自

FloatingObject.x


y

y(value?): any

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

代码示例

//本示例创建了一个浮动对象
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);

参数

属性名 类型 说明
value? number 获取或设置浮动对象元素的垂直位置

返回值

any

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

继承自

FloatingObject.y