@@ -6,7 +6,7 @@ library(XML)
6
6
#
7
7
# TODO: test gnummeric and koffice generated ODS files
8
8
# TODO: check if emtpy rows are the only ones with "number-rows-repeated"...
9
- # ALSO number-columns-repeated
9
+ # ALSO number-columns-repeated -- FIXED
10
10
#
11
11
# the thing i should have probably read (AKA the ODS standard :P):
12
12
# http://docs.oasis-open.org/office/v1.2/os/OpenDocument-v1.2-os-part1.html#__RefHeading__1420324_253892949
@@ -49,14 +49,13 @@ read.ods=function(file=NULL, sheet=NULL, formulaAsFormula=F){
49
49
for (sheeti in sheets [names(sheets )== " table" ]){
50
50
sheetIndex = sheetIndex + 1
51
51
# sheeti=sheets[[3]]
52
-
52
+
53
53
d = list ()
54
54
d [1 ]= " " # avoid bug later on if no rows
55
55
# fill it
56
56
rowIndex = 0
57
57
for (row in sheeti [names(sheeti )== " table-row" ]){
58
58
rowIndex = rowIndex + 1
59
- # print(rowIndex)
60
59
if (! is.na(xmlAttrs(row )[" number-rows-repeated" ])){
61
60
# only on empty rows???
62
61
rowIndex = rowIndex + as.integer(xmlAttrs(row )[[" number-rows-repeated" ]])- 1
@@ -69,17 +68,12 @@ read.ods=function(file=NULL, sheet=NULL, formulaAsFormula=F){
69
68
if (is.null(xmlAttrs(cell ))){ # silly liblre office has: <table:table-cell/>
70
69
next
71
70
}
72
- # print(colIndex)
73
- print(paste(" row:" ,rowIndex ," col:" ,colIndex ,sep = " " ))
71
+ # print(paste("row:",rowIndex," col:",colIndex,sep=""))
74
72
# <table:table-cell table:number-columns-repeated="3"/>
75
- # colsRepeated=1
76
- # print(names(cell))
77
- # print(length((names(cell))))
78
73
if (! is.na(xmlAttrs(cell )[" number-columns-repeated" ]) && length((names(cell )))== 0 ){
79
74
# print(as.integer(xmlAttrs(cell)[["number-columns-repeated"]]))
80
75
# repeat empty columns
81
76
colIndex = colIndex + as.integer(xmlAttrs(cell )[[" number-columns-repeated" ]])- 1
82
- # colsRepeated=as.integer(xmlAttrs(cell)[["number-columns-repeated"]]
83
77
next
84
78
}
85
79
# display the formula instead of its result
@@ -265,6 +259,8 @@ lettersToNumber=function( listOfStrings=NULL){
265
259
# ' libre office can do crap like this:
266
260
# ' <text:p>></text:p>
267
261
# ' which is not valid xml... and the XML package doesn't like that..
262
+ # ' OK NM NOW IT DOES! leaving the code here in case of changes...
263
+ # '
268
264
# ' also to not make the code fulgy as all hell, the content.xml file is first scanned for these XML violations, and then fixed!
269
265
# ' <text:p>></text:p> --> <text:p>></text:p>
270
266
# ' @param file - the xml file to be parsed...
0 commit comments