Ethercalc的單元格取值

本地架設Ethercalc後,訪問http://localhost:8000進入ethercalc首頁,創建新的工作簿,在A1單元格輸入數據1,A2單元格輸入數據2,A3輸入公式(=A1+A2),頁面顯示如下:



取單元格數據代碼如下:

import javax.ws.rs.client.Client;  
import javax.ws.rs.client.ClientBuilder;  
import javax.ws.rs.core.Response;  
import javax.ws.rs.core.MediaType;  
  
public class getValue {  
    public static void main(String args[]) {  
  
        Client client = ClientBuilder.newClient();  
        Response response = client  
                .target("http://localhost:8000/_/aaa/cells/A1")  
                .request(MediaType.TEXT_PLAIN_TYPE).get();  
  
        System.out.println("status: " + response.getStatus());  
        System.out.println("headers: " + response.getHeaders());  
        System.out.println("body:" + response.readEntity(String.class));  
    }  
} 


控制檯顯示:

A1單元格:

status: 200
headers: {ETag=[W/"59-3383904219"], Date=[Mon, 10 Oct 2016 08:22:41 GMT], Content-Length=[89], Connection=[keep-alive], Content-Type=[application/json; charset=utf-8], X-Powered-By=[Zappa 0.5.0]}
body:{"coord":"A1","datavalue":1,"datatype":"v","formula":"","valuetype":"n","readonly":false}

A3單元格:

status: 200
headers: {ETag=[W/"d3-496882608"], Date=[Mon, 10 Oct 2016 08:25:31 GMT], Content-Length=[211], Connection=[keep-alive], Content-Type=[application/json; charset=utf-8], X-Powered-By=[Zappa 0.5.0]}
body:{"coord":"A3","datavalue":3,"datatype":"f","formula":"A1+A2","valuetype":"n","readonly":false,"parseinfo":[{"text":"A1","type":2,"opcode":0},{"text":"+","type":3,"opcode":"+"},{"text":"A2","type":2,"opcode":0}]}


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章