跳到主要内容

自动调整文本框

自动调整文档中的所有文本框大小。

(function () {
let doc = Api.GetDocument();
let width = 6 * 240;
let height = 2 * 240;
// 所有文本框的自动调整属性设置为true
doc.GetAllForms()
.filter(form => form.GetFormType() === "textForm")
.forEach(form => {
form.ToFixed(width, height);
form.SetAutoFit(true);
});
})();

使用方法:获取文档获取所有表单, 获取表单类型固定尺寸设置自动调整

结果

自动填写表单 自动填写表单