找回密码
 立即注册

QQ登录

只需一步,快速开始

AlexZ 讲师达人认证 悬赏达人认证 SpreadJS 开发认证
超级版主   /  发表于:2023-5-26 17:32  /   查看:952  /  回复:0
本帖最后由 AlexZ 于 2023-6-15 14:16 编辑

背景
SpreadJS 现在支持 TextBox Shapes,可以在工作表的任何位置添加框,其中包含文本。
还可以利用 resizeToFitText 选项自动调整文本框的大小以适应用户的输入。
image.png454454650.png

API
GC.Spread.Sheets.Shapes.Shape.prototype.isTextBox
  1. ///* function isTextBox(value?: boolean): any
  2.   /**
  3.     * Gets or sets the shape is text box.
  4.     * @param {boolean} value The value indicating whether the shape is a text box.
  5.     * @returns {boolean | void} If no value is set, return whether shape is a text box.
  6.     * @example
  7.     * var rectangle = sheet.shapes.add("Shape1", GC.Spread.Sheets.Shapes.AutoShapeType.rectangle, 100, 60, 200, 160);
  8.     * rectangle.isTextBox(true);
  9.     */
复制代码

GC.Spread.Sheets.Shapes.IShapeTextFrame
  1. ///* field textFrame: GC.Spread.Sheets.Shapes.IShapeTextFrame
  2. /**
  3.   * Indicates the text frame options.
  4.   * @property {GC.Spread.Sheets.VerticalAlign | string} [vAlign] - The text vertical alignment, it is VerticalAlign enum or formula(starts with =).
  5.   * @property {GC.Spread.Sheets.HorizontalAlign | string} [hAlign] - The text horizontal alignment, it is HorizontalAlign enum or formula(starts with =).
  6.   * @property {boolean} [resizeToFitText] - Resize the shape to fit text size.
  7.   * @type {Object}
  8.   * @example
  9.   * // This sample sets the resizeToFitText for the shape.
  10.   * var rectangle = sheet.shapes.add("Shape1", GC.Spread.Sheets.Shapes.AutoShapeType.rectangle, 100, 60, 200, 160);
  11.   * var oldStyle = rectangle.style();
  12.   * oldStyle.textFrame.resizeToFitText= true;
  13.   * rectangle.style(oldStyle);
  14.   */
复制代码

限制
  • 不支持垂直文本
  • 不支持富文本

0 个回复

您需要登录后才可以回帖 登录 | 立即注册
返回顶部