谢谢您的反馈。
单元格的Value指的是和数据源相关的值,而Text指的是包含格式的文字。
从您的代码来看,您对这个的意思理解有误,感觉您需要使用的是一个对应关系。
您可以通过如下代码来理解Text和Value
- $(document).ready(function () {
- var spread = new GcSpread.Sheets.Spread($("#ss").get(0),{sheetCount:3});
- var sheet = spread.getActiveSheet();
- sheet.getCell(0, 0).formatter("0.00_);(0.00)");
- sheet.getCell(1, 0).formatter("0.00_);(0.00)");
- sheet.getCell(0, 1).formatter("0.00_);(0.00)");
- sheet.getCell(1, 1).formatter("0.00_);(0.00)");
- //Set values to Text property
- sheet.getCell(0, 0).text(10);
- //Set values by calling SetText method
- sheet.setText(1, 0, 10);
- //Set values to Value property.
- sheet.getCell(0, 1).value(10);
- //Set values by calling SetValue method.
- sheet.setValue(1, 1, 10);
- $("#button1").click(function(){
- alert("Obtaining cell values by referring to Text property: " + sheet.getCell(0, 0).text() + "\n" +
- "Obtaining cell values by calling GetText method: " + sheet.getText(1, 0) + "\n" +
- "Obtaining cell values by referring to Value property: " + sheet.getCell(0, 1).value() + "\n" +
- "Obtaining cell values by calling GetValue method: " + sheet.getValue(1, 1));
- });
- });
复制代码 |