SpreadJS Documentation
Getting Cell Values

You can get the values from the cells.

Using Code

This example gets the cell values.

JavaScript
Copy Code
$(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));
    });
});

 

 


Copyright © GrapeCity, inc. All rights reserved.

Send comments on this topic.