File indexing completed on 2024-05-19 16:08:40

0001 #!/bin/bash
0002 #
0003 # IMPORTANT: this is like the slowest thing ever. But it works. Usually.
0004 # Requires an open instance of KSpread, with openformula-test.ods loaded.
0005 #
0006 
0007 KSPREAD=`dcopfind 'kspread*'`
0008 KSPREAD=`echo $KSPREAD | sed s/DCOPRef\(// | sed s/,\)//`
0009 for i in `seq 51 514`
0010   do
0011   CELLREF=`dcop $KSPREAD Document/Map/List1 cell 7 $i`
0012   PASS=`dcop $CELLREF value`
0013   if test $PASS = 1.000000
0014     then
0015     CELLREF=`dcop $KSPREAD Document/Map/List1 cell 2 $i`
0016     formula=`dcop $CELLREF text`
0017     formula=`echo $formula | sed s/\"/\\\\\\\\\"/g`
0018     
0019 #nothing if formula contains a cellref ...
0020     if test -z "`echo $formula | grep B[1-9]`"
0021       then
0022       CELLREF=`dcop $KSPREAD Document/Map/List1 cell 3 $i`
0023       result=`dcop $CELLREF text`
0024 #test whether we have a number
0025       if test $result = True
0026         then
0027         VAL="true"
0028       else if test $result = False
0029         then
0030         VAL="false"
0031       else if test -z `echo $result | grep -P "^\d+([\.,]\d+)?$"`
0032         then
0033         VAL="\"${result}\""
0034       else
0035         result=`echo $result | sed s/,/./`
0036         VAL=$result
0037       fi;fi;fi
0038       echo "CHECK_EVAL(\"=${formula}\", Value($VAL));  // row $i"
0039     fi
0040   else echo // Not passed for line $i.
0041   fi
0042 done
0043 
0044