COOPY » Guide
version 0.6.5
|
00001 #include <coopy/JsWrap.h> 00002 #include <stdio.h> 00003 00004 #include <coopy/SocialCalcSheet.h> 00005 #include <coopy/SocialCalcTextBook.h> 00006 00007 using namespace std; 00008 using namespace coopy::js; 00009 using namespace coopy::store; 00010 using namespace coopy::store::socialcalc; 00011 00012 extern std::string socialcalc_3(); 00013 extern std::string socialcalcconstants(); 00014 extern std::string socialcalctableeditor(); 00015 extern std::string socialcalcspreadsheetcontrol(); 00016 extern std::string socialcalcwrap(); 00017 00018 int main(int argc, char *argv[]) { 00019 JsWrap js; 00020 js.apply(socialcalc_3()); 00021 js.apply(socialcalcconstants()); 00022 js.apply(socialcalctableeditor()); 00023 js.apply(socialcalcspreadsheetcontrol()); 00024 00025 js.apply(socialcalcwrap()); 00026 00027 js.apply("create_spreadsheet()"); 00028 string result = js.apply("test_sheet()"); 00029 printf("[%s]\n", result.c_str()); 00030 00031 00032 SocialCalcTextBook book; 00033 PolySheet sheet = book.readSheetByIndex(0); 00034 if (!sheet.isValid()) { 00035 fprintf(stderr,"Cannot get sheet\n"); 00036 } 00037 sheet.cellString(0,0,"foo"); 00038 sheet.cellString(1,0,"bar"); 00039 //sheet.moveColumn(ColumnRef(0),ColumnRef(1)); 00040 sheet.moveColumn(ColumnRef(1),ColumnRef(0)); 00041 sheet.insertColumn(ColumnRef(0)); 00042 sheet.cellString(1,0,"zig",true); 00043 sheet.insertColumn(ColumnRef(3)); 00044 printf(">>>\n%s\n", sheet.toString().c_str()); 00045 sheet.insertRow(RowRef(-1)); 00046 printf(">>>\n%s\n", sheet.toString().c_str()); 00047 sheet.cellString(1,0,"zig",true); 00048 printf(">>>\n%s\n", sheet.toString().c_str()); 00049 sheet.insertRow(RowRef(-1)); 00050 printf(">>>\n%s\n", sheet.toString().c_str()); 00051 sheet.insertRow(RowRef(0)); 00052 printf(">>>\n%s\n", sheet.toString().c_str()); 00053 Property p; 00054 p.put("file","hi.sc"); 00055 SocialCalcTextBook::write(&book,p); 00056 00057 00058 printf("done\n"); 00059 00060 return 0; 00061 }