|
[XQuery Talk Mailing List Archive Home] [By Date] [By Thread] [By Subject] [By Author] [Recent Entries] [Reply To This Message] Excel XML Cell index problemJesse Wu jesse.wu68 at gmail.comThu Aug 20 16:15:59 PDT 2009
Trying to evaluate if XQuery is the right tool to use to process large
Excel workbook, XLS when save as XML:
<Workbook><Worksheet><Table>
<Row>
<Cell>AAA</Cell>
<Cell Index="5" HRef= "http:??...">YYY</Cell>
.
.
<Cell Index="23">XXX</Cell>
.
</Row>
<Row>
...
</Row>
My XQuery code is looping through each row then the cells in each row,
but unfortunately Microsoft Excel when save as XML skips empty cells,
as the example above in the 1st row, the cells(columns) from 2 to 4
were missing before the 2nd cell with Index="5" which means it's
actually column 5 (I was expecting to have 3 <Cell /> before it). Is
there a way to code this in Xquery?
My code:
let $pads : = 0
for $i in 1 to count($Row/Cell)
let $f := $i + $pads
return
<dummy>
{ xu:padcells($Row/Cell[$i], $f) }
{$tr/Cell[$i]}
</dummy>
};
declare function xu:padcells($cl, $f)
{
let $t := xs:integer($cl/@Index) -1
(: let $pads := $pads + ($f - $t )+ 1 is there a way to get the total
number of empty cells padded back to the calling code? :)
for $x in $f to $t
return
<Cell Index="{$x}"></Cell>
};
Thanks in advance for all your help.
-Jes
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|






