COOPY » Guide  version 0.6.5
/home/paulfitz/cvs/coopy_scm/coopy/src/ssinsert/ssinsert.cpp
Go to the documentation of this file.
00001 #include <stdio.h>
00002 #include <string.h>
00003 
00004 #include <coopy/CsvFile.h>
00005 
00006 extern "C" {
00007 #include "coopy/gnumeric_link.h"
00008 }
00009 
00010 using namespace coopy::store;
00011 using namespace std;
00012 
00013 int main(int argc, char *argv[]) {
00014   if (argc<4) {
00015     printf("Call as:\n");
00016     printf("  ssinsert template.xls data.csv target.xls\n");
00017     return 1;
00018   }
00019   const char *template_name = argv[1];
00020   const char *data_name = argv[2];
00021   const char *target_name = argv[3];
00022 
00023   gnumeric_init();
00024   GnumericWorkbookPtr book = gnumeric_load(template_name);
00025   CsvSheet data;
00026   CsvFile::read(data_name,data);
00027   SheetStyle style;
00028   string sdata = data.encode(style);
00029   char *start = (char*)(sdata.c_str());
00030   char *stop = (char*)(start+sdata.length());
00031   gnumeric_overlay_csv(book,start,stop);
00032   gnumeric_save(book,target_name);
00033   gnumeric_free(book);
00034   gnumeric_fini();
00035   return 0;
00036 }
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines