[{"id":"b66f8b1e-cc14-4e89-9679-abd5687d283d","tags":[{"product":null,"links":null,"id":"9e117e35-984a-4c14-95ca-ef0ec7b9fb60","name":"\u65B0\u589E","color":"DarkGreen","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"569bb90a-ea68-46c6-96f1-ab151c120714","tags":[{"product":null,"links":null,"id":"a2f84374-4a3f-4d22-96fd-765e9de495bf","name":"\u66F4\u65B0","color":"Coral","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"5eb52f08-2d1a-4362-9ffc-4871bdc10f3f","tags":[{"product":null,"links":null,"id":"a2f84374-4a3f-4d22-96fd-765e9de495bf","name":"\u66F4\u65B0","color":"Coral","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"341dd607-b97d-4d70-bde2-53acda6b6c95","tags":[{"product":null,"links":null,"id":"a2f84374-4a3f-4d22-96fd-765e9de495bf","name":"\u66F4\u65B0","color":"Coral","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"05349273-414f-4208-9ea2-c4fc8f4ea2cb","tags":[{"product":null,"links":null,"id":"a2f84374-4a3f-4d22-96fd-765e9de495bf","name":"\u66F4\u65B0","color":"Coral","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"86089f76-b778-4d52-821e-6f27de3df613","tags":[{"product":null,"links":null,"id":"9e117e35-984a-4c14-95ca-ef0ec7b9fb60","name":"\u65B0\u589E","color":"DarkGreen","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"b81e4fd6-1fc5-43a0-a258-b6e16a5cbec6","tags":[{"product":null,"links":null,"id":"a2f84374-4a3f-4d22-96fd-765e9de495bf","name":"\u66F4\u65B0","color":"Coral","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"8aa8ce31-43e4-438e-951f-241608435260","tags":[{"product":null,"links":null,"id":"a2f84374-4a3f-4d22-96fd-765e9de495bf","name":"\u66F4\u65B0","color":"Coral","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"37343f41-6ec2-4c7e-b21d-2cc18d5ce1e0","tags":[{"product":null,"links":null,"id":"a2f84374-4a3f-4d22-96fd-765e9de495bf","name":"\u66F4\u65B0","color":"Coral","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"5915e52f-64f8-4146-b8bd-81bead6324a3","tags":[{"product":null,"links":null,"id":"a2f84374-4a3f-4d22-96fd-765e9de495bf","name":"\u66F4\u65B0","color":"Coral","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"836ba889-af9e-460d-a4cc-c24d922795f2","tags":[{"product":null,"links":null,"id":"a2f84374-4a3f-4d22-96fd-765e9de495bf","name":"\u66F4\u65B0","color":"Coral","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"4ae14b06-bb68-4394-a210-a46b8f028346","tags":[{"product":null,"links":null,"id":"a2f84374-4a3f-4d22-96fd-765e9de495bf","name":"\u66F4\u65B0","color":"Coral","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"d8f42066-e9dc-4411-bdcf-43b1a203370c","tags":[{"product":null,"links":null,"id":"9e117e35-984a-4c14-95ca-ef0ec7b9fb60","name":"\u65B0\u589E","color":"DarkGreen","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"7ef86f16-b1a0-49f7-9592-612b9be02b25","tags":[{"product":null,"links":null,"id":"a2f84374-4a3f-4d22-96fd-765e9de495bf","name":"\u66F4\u65B0","color":"Coral","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"b29c7775-a9a4-451e-a1b5-01d19ed5ca5e","tags":[{"product":null,"links":null,"id":"9e117e35-984a-4c14-95ca-ef0ec7b9fb60","name":"\u65B0\u589E","color":"DarkGreen","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"e56f3989-8f81-46af-90fa-a4813eeb976f","tags":[{"product":null,"links":null,"id":"9e117e35-984a-4c14-95ca-ef0ec7b9fb60","name":"\u65B0\u589E","color":"DarkGreen","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"2526c963-f170-45a8-923e-91b0712a9810","tags":[{"product":null,"links":null,"id":"9e117e35-984a-4c14-95ca-ef0ec7b9fb60","name":"\u65B0\u589E","color":"DarkGreen","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"24575cf0-501a-44f9-8426-c40f8f4b5552","tags":[{"product":null,"links":null,"id":"a2f84374-4a3f-4d22-96fd-765e9de495bf","name":"\u66F4\u65B0","color":"Coral","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"1a6f8d7f-acd6-42be-8c4f-f464c6218381","tags":[{"product":null,"links":null,"id":"a2f84374-4a3f-4d22-96fd-765e9de495bf","name":"\u66F4\u65B0","color":"Coral","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"82b176fd-5cab-498c-909e-8fa7d29c38d8","tags":[{"product":null,"links":null,"id":"9e117e35-984a-4c14-95ca-ef0ec7b9fb60","name":"\u65B0\u589E","color":"DarkGreen","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"1708b3a9-4f37-44a8-8f0e-f9a2d2e5d940","tags":[{"product":null,"links":null,"id":"9e117e35-984a-4c14-95ca-ef0ec7b9fb60","name":"\u65B0\u589E","color":"DarkGreen","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"c9ac246e-29fb-4bc4-8231-8439795bb590","tags":[{"product":null,"links":null,"id":"9e117e35-984a-4c14-95ca-ef0ec7b9fb60","name":"\u65B0\u589E","color":"DarkGreen","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"94f2a5c3-2539-436a-af75-23fbbd1a3957","tags":[{"product":null,"links":null,"id":"a2f84374-4a3f-4d22-96fd-765e9de495bf","name":"\u66F4\u65B0","color":"Coral","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"d99594f4-2d40-4df4-9419-ba2ca6aa3f7f","tags":[{"product":null,"links":null,"id":"9e117e35-984a-4c14-95ca-ef0ec7b9fb60","name":"\u65B0\u589E","color":"DarkGreen","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"fd66e72d-0f10-4f57-9807-6db26290ab2e","tags":[{"product":null,"links":null,"id":"a2f84374-4a3f-4d22-96fd-765e9de495bf","name":"\u66F4\u65B0","color":"Coral","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"8f344863-503d-4bc3-a594-3815e7d55f5c","tags":[{"product":null,"links":null,"id":"9e117e35-984a-4c14-95ca-ef0ec7b9fb60","name":"\u65B0\u589E","color":"DarkGreen","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"9be82601-de9d-4c18-948a-23ab6f4dd431","tags":[{"product":null,"links":null,"id":"9e117e35-984a-4c14-95ca-ef0ec7b9fb60","name":"\u65B0\u589E","color":"DarkGreen","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"6495f3c0-b463-47e0-b08a-ca949672211e","tags":[{"product":null,"links":null,"id":"9e117e35-984a-4c14-95ca-ef0ec7b9fb60","name":"\u65B0\u589E","color":"DarkGreen","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"b4bede08-3f08-4839-ba4a-abc7ac195bde","tags":[{"product":null,"links":null,"id":"9e117e35-984a-4c14-95ca-ef0ec7b9fb60","name":"\u65B0\u589E","color":"DarkGreen","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"4afcdfc0-3ff5-4f2b-a223-f8fc042a5bbe","tags":[{"product":null,"links":null,"id":"9e117e35-984a-4c14-95ca-ef0ec7b9fb60","name":"\u65B0\u589E","color":"DarkGreen","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"422062c4-fa40-4771-a86f-008efe6d86e5","tags":[{"product":null,"links":null,"id":"9e117e35-984a-4c14-95ca-ef0ec7b9fb60","name":"\u65B0\u589E","color":"DarkGreen","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"d87e8013-86a7-4840-8d25-6f62e14eb4ac","tags":[{"product":null,"links":null,"id":"9e117e35-984a-4c14-95ca-ef0ec7b9fb60","name":"\u65B0\u589E","color":"DarkGreen","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"a6acedfd-4043-4c64-a5d1-aec3326df9e7","tags":[{"product":null,"links":null,"id":"9e117e35-984a-4c14-95ca-ef0ec7b9fb60","name":"\u65B0\u589E","color":"DarkGreen","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"dbdc0b24-06c4-48b9-8d6c-7455119dc773","tags":[{"product":null,"links":null,"id":"9e117e35-984a-4c14-95ca-ef0ec7b9fb60","name":"\u65B0\u589E","color":"DarkGreen","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"a3856849-954a-4cfc-96a6-382e530d3638","tags":[{"product":null,"links":null,"id":"a2f84374-4a3f-4d22-96fd-765e9de495bf","name":"\u66F4\u65B0","color":"Coral","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]},{"id":"4a39306b-ffa5-433d-80a3-28e41f929b72","tags":[{"product":null,"links":null,"id":"a2f84374-4a3f-4d22-96fd-765e9de495bf","name":"\u66F4\u65B0","color":"Coral","productId":"098be112-50ec-44e4-b746-6bc8bf76af97"}]}]
        
(Showing Draft Content)

双击自动填充

SpreadJS允许用户在表单的列中自动填充数据(公式和值)。 用户只需双击所选单元格的填充手柄即可将单元格中的内容填充到整个列中。 填充手柄允许用户使用四种不同类型的选项填充数据- 复制单元格填充系列填充格式 无需格式化即可填充

在使用业务应用程序时,用户经常需要处理包含数百行或数千行包含公式的数据的表单。 使用双击进行自动填充,使用户可以快速方便地自动填充列公式,而无需使用鼠标手动拖动和填充,从而节省了最终用户的时间并减少了可能的错误。

使用双击进行自动填充操作

双击填充后,将根据startRange(已包含数据的单元格区域)的内容填充列下方的空单元格(称为fillRange)。

以下是可以使用双击执行的各种自动填充操作。

  • Auto Fill Number -如果startRange包含数字值,则填充句柄将自动完成整列中的数字列表,如下所示。 数字序列将根据相应的模式和填充手柄的选定选项进行填充。
  • Auto Fill Dates - 如果startRange包含日期值,则填充句柄将自动完成整列中的日期列表,如下所示。 默认情况下,当您双击自动填充日期时,填充手柄将执行“复制单元格”操作。 要填充连续的日期,您可以打开拖动填充智能标记,然后选择“填充系列”选项。
  • Auto Fill Formulas - 如果startRange包含公式,则填充句柄将公式向下复制到整个列中,如下所示。

注意: 双击进行自动填充操作时应牢记以下几点。

1) 仅当填充手柄附近的列中有非空单元格时,这种类型的自动填充才有效。

2)当您双击填充手柄以填充列中的数据时,它将仅向下延伸到当前区域中的最后一个非空单元格。

3)另外,如果相邻列包含一些空单元格,则双击填充手柄将填充该列,直到相邻列中的最后一个非空单元格。



代码

请参考以下代码段,以便在表单中双击来自动填充值和公式。

// 自动填充数值和公式
var spread = new GC.Spread.Sheets.Workbook(document.getElementById('ss'), { sheetCount: 4 });
var sheet = spread.getActiveSheet();
// 在默认表单中设置值
sheet.setValue(0, 0, 'Name'); sheet.setValue(1, 0, 'Jack');
sheet.setValue(2, 0, 'Lily'); sheet.setValue(3, 0, 'Linda');
sheet.setValue(4, 0, 'John'); sheet.setValue(5, 0, 'Bob');
sheet.setValue(6, 0, 'Ming'); sheet.setValue(7, 0, 'Gorge');
sheet.setValue(8, 0, 'Kobe'); sheet.setValue(9, 0, 'James');
sheet.setValue(10, 0, 'Faker'); sheet.setValue(11, 0, 'Tai');
sheet.setValue(12, 0, 'Peter'); sheet.setValue(0, 1, 'Index');
sheet.setValue(1, 1, 1); sheet.setValue(2, 1, 2);
var sheet1 = spread.getSheet(1);
// 在“ sheet1”表单中设置值
sheet1.setValue(0, 0, 'Product'); sheet1.setValue(1, 0, 'P1');
sheet1.setValue(2, 0, 'P2'); sheet1.setValue(3, 0, 'P3');
sheet1.setValue(4, 0, 'P4'); sheet1.setValue(5, 0, 'P5');
sheet1.setValue(6, 0, 'P6'); sheet1.setValue(7, 0, 'P7');
sheet1.setValue(8, 0, 'P8'); sheet1.setValue(9, 0, 'P9');
sheet1.setValue(10, 0, 'P10'); sheet1.setValue(11, 0, 'P11');
sheet1.setValue(12, 0, 'P12');
sheet1.setValue(0, 1, 'Price');
sheet1.setValue(1, 1, 1.1); sheet1.setValue(2, 1, 1.5);
sheet1.setValue(3, 1, 1.6); sheet1.setValue(4, 1, 1.2);
sheet1.setValue(5, 1, 1.5); sheet1.setValue(6, 1, 0.8);
sheet1.setValue(7, 1, 0.8); sheet1.setValue(8, 1, 1.0);
sheet1.setValue(9, 1, 2.2); sheet1.setValue(10, 1, 2.0);
sheet1.setValue(11, 1, 0.7); sheet1.setValue(12, 1, 1.5);
sheet1.setValue(0, 2, 'Units'); sheet1.setValue(1, 2, 11);
sheet1.setValue(2, 2, 13); sheet1.setValue(3, 2, 10);
sheet1.setValue(4, 2, 9); sheet1.setValue(5, 2, 8);
sheet1.setValue(6, 2, 5); sheet1.setValue(7, 2, 10);
sheet1.setValue(8, 2, 16); sheet1.setValue(9, 2, 9);
sheet1.setValue(10, 2, 7); sheet1.setValue(11, 2, 10);
sheet1.setValue(12, 2, 14); sheet1.setValue(0, 3, 'Comment');
sheet1.setValue(0, 4, 'Revenue');
sheet1.setFormula(1, 4, '=B2*C2');
var sheet2 = spread.getSheet(2);
// Set values in the "sheet2" worksheet
sheet2.setValue(0, 0, 'Product'); sheet2.setValue(1, 0, 'P1');
sheet2.setValue(2, 0, 'P2'); sheet2.setValue(3, 0, 'P3');
sheet2.setValue(4, 0, 'P4'); sheet2.setValue(5, 0, 'P5');
sheet2.setValue(6, 0, 'P6'); sheet2.setValue(7, 0, 'P7');
sheet2.setValue(8, 0, 'P8'); sheet2.setValue(9, 0, 'P9');
sheet2.setValue(10, 0, 'P10'); sheet2.setValue(11, 0, 'P11');
sheet2.setValue(12, 0, 'P12'); sheet2.setValue(0, 1, 'Price');
sheet2.setValue(1, 1, 1.1); sheet2.setValue(2, 1, 1.5);
sheet2.setValue(3, 1, 1.6); sheet2.setValue(4, 1, 1.2);
sheet2.setValue(5, 1, 1.5); sheet2.setValue(6, 1, 0.8);
sheet2.setValue(7, 1, 0.8); sheet2.setValue(8, 1, 1.0);
sheet2.setValue(9, 1, 2.2); sheet2.setValue(10, 1, 2.0);
sheet2.setValue(11, 1, 0.7); sheet2.setValue(12, 1, 1.5);
sheet2.setValue(0, 2, 'Units'); sheet2.setValue(1, 2, 11);
sheet2.setValue(2, 2, 13); sheet2.setValue(3, 2, 10);
sheet2.setValue(4, 2, 9); sheet2.setValue(5, 2, 8);
sheet2.setValue(6, 2, 5); sheet2.setValue(7, 2, 10);
sheet2.setValue(8, 2, 16); sheet2.setValue(9, 2, 9);
sheet2.setValue(10, 2, 7); sheet2.setValue(11, 2, 10);
sheet2.setValue(12, 2, 14); sheet2.setValue(0, 3, 'Comment');
sheet2.setValue(0, 4, 'Revenue'); sheet2.setValue(7, 4, 'STOP');
sheet2.setFormula(1, 4, '=B2*C2');
var sheet3 = spread.getSheet(3);
// 在“ sheet3”表单中设置值
sheet3.setValue(0, 4, 'Product'); sheet3.setValue(1, 4, 'P1');
sheet3.setValue(2, 4, 'P2'); sheet3.setValue(3, 4, 'P3');
sheet3.setValue(4, 4, 'P4'); sheet3.setValue(5, 4, 'P5');
sheet3.setValue(6, 4, 'P6'); sheet3.setValue(7, 4, 'P7');
sheet3.setValue(8, 4, 'P8'); sheet3.setValue(9, 4, 'P9');
sheet3.setValue(10, 4, 'P10'); sheet3.setValue(11, 4, 'P11');
sheet3.setValue(12, 4, 'P12'); sheet3.setValue(0, 3, 'Price');
sheet3.setValue(1, 3, 1.1); sheet3.setValue(2, 3, 1.5);
sheet3.setValue(3, 3, 1.6); sheet3.setValue(4, 3, 1.2);
sheet3.setValue(5, 3, 1.5); sheet3.setValue(6, 3, 0.8);
sheet3.setValue(7, 3, 0.8); sheet3.setValue(8, 3, 1.0);
sheet3.setValue(9, 3, 2.2); sheet3.setValue(10, 3, 2.0);
sheet3.setValue(11, 3, 0.7); sheet3.setValue(12, 3, 1.5);
sheet3.setValue(0, 2, 'Units'); sheet3.setValue(1, 2, 11);
sheet3.setValue(2, 2, 13); sheet3.setValue(3, 2, 10);
sheet3.setValue(4, 2, 9); sheet3.setValue(5, 2, 8);
sheet3.setValue(6, 2, 5); sheet3.setValue(7, 2, 10);
sheet3.setValue(8, 2, 16); sheet3.setValue(9, 2, 9);
sheet3.setValue(10, 2, 7); sheet3.setValue(11, 2, 10);
sheet3.setValue(12, 2, 14); sheet3.setValue(0, 1, 'Comment');
sheet3.setValue(0, 0, 'Revenue');
sheet3.setFormula(1, 0, '=C2*D2');