[R] odfWeave: odt-file damaged
ukoenig at med.uni-marburg.de
ukoenig at med.uni-marburg.de
Wed Jul 8 00:11:20 CEST 2009
Hi,
I think, I can answer my own posting. I found out, that the directory
structure
of the ODT-file created by "odfWeave" causes the error message.
The file structure of the unzipped odt-file looks like this:
<DIR> Pictures
content_1-Boxplot.png
content.xml
current.xml
manifest.xml
meta.xml
mimetype
settings.xml
styles.xml
thumbnail.png
But it should look like this:
<DIR> META-INF
manifest.xml
<DIR> Thumbnails
thumbnail.png
<DIR> Pictures
content_1-Boxplot.png
meta.xml
mimetype
settings.xml
styles.xml
content.xml
Now I know. what causes the message "odt file damaged",
but I don´t know a solution. Does anyone do so?
Thanks, Udo
> Dear all,
> I am doing my first steps with odfWeave.
>
> After running the r code (see below), I am trying to open the ODF-document
> with open office, but I am getting the error message:
>
> "The file is damaged, but it can be repaired". If I confirm the question and
> repair the file with open office, I can open it with the desired output,
> which seems to be fine.
>
> My system:
> R Version 2.9.1
> Open Office 3.0.1
> 7-Zip 4.65
> Windows XP
>
> Using zip (http://www.info-zip.org/, zip232xN.zip) had the same result.
>
> What causes the error message? Is the structure of the ODF document
> as it should be (for the structure please have a look at the bottom of
> this mail)?
>
> I'd greatly appreciate any help.
>
>
> Udo K o e n i g
>
> Clinic for Child and Adolescent Psychiatry
> Philipps University of Marburg, Germany
>
>
> #######################################################################
> #R code
> library(odfWeave)
>
> #odfWeave call
> odfWeave("c:/temp/odfWeave-test.odt", "c:/temp/odfWeave-test-out.odt",
> control=odfWeaveControl(zipCmd = c("7z a -tzip $$file$$ .",
> "7z e -tzip $$file$$")))
>
> #######################################################################
> # Contents of my Open office document
>
> <<Initiate, results = hide, echo= FALSE>>=
> #First steps with odfWeave
> attach(iris)
> @
>
> There are \Sexpr{length(iris[, 1])} observations.
>
> <<Table, echo=FALSE, results= xml>>=
> odfTable(iris[1:5,])
> @
>
> <<Table2, echo=FALSE, results= xml>>=
> tab <- round(apply(iris[, 1:4], 2, mean), 2)
> odfTable(tab, horizontal= TRUE)
> @
>
> <<Boxplot, echo=FALSE, fig=TRUE>>=
> boxplot(Sepal.Length~Species)
> @
>
> #######################################################################
> #Log
>
>> odfWeave("c:/temp/odfWeave-test.odt", "c:/temp/odfWeave-test-out.odt",
> + control=odfWeaveControl(zipCmd = c("7z a -tzip $$file$$ .",
> + "7z e -tzip $$file$$")))
> Copying c:/temp/odfWeave-test.odt
> Setting wd to
> C:\DOCUME~1\Udo_2\LOCALS~1\Temp\Rtmp6QrXgk/odfWeave05190748330
> Unzipping ODF file using 7z e -tzip "odfWeave-test.odt"
>
> 7-Zip 4.65 Copyright (c) 1999-2009 Igor Pavlov 2009-02-03
>
> Processing archive: odfWeave-test.odt
>
> Extracting mimetype
> Extracting Configurations2\statusbar
> Extracting Configurations2\accelerator\current.xml
> Extracting Configurations2\floater
> Extracting Configurations2\popupmenu
> Extracting Configurations2\progressbar
> Extracting Configurations2\menubar
> Extracting Configurations2\toolbar
> Extracting Configurations2\images\Bitmaps
> Extracting content.xml
> Extracting styles.xml
> Extracting meta.xml
> Extracting Thumbnails\thumbnail.png
> Extracting settings.xml
> Extracting META-INF\manifest.xml
>
> Everything is Ok
>
> Folders: 7
> Files: 8
> Size: 28518
> Compressed: 8768
>
> Removing odfWeave-test.odt
> Creating a Pictures directory
>
> Pre-processing the contents
> Sweaving content.Rnw
>
> Writing to file content_1.xml
> Processing code chunks ...
> 1 : term hide(label=Initiate)
> 2 : term xml(label=Table)
> 3 : term xml(label=Table2)
> 4 : term verbatim(label=Boxplot)
>
> 'content_1.xml' has been Sweaved
>
> Removing content.xml
>
> Post-processing the contents
> Removing content.Rnw
> Removing styles.xml
> Renaming styles_2.xml to styles.xml
> Removing extra files
>
> Packaging file using 7z a -tzip "odfWeave-test.odt" .
>
> 7-Zip 4.65 Copyright (c) 1999-2009 Igor Pavlov 2009-02-03
> Scanning
>
> Creating archive odfWeave-test.odt
>
> Compressing content.xml
> Compressing current.xml
> Compressing manifest.xml
> Compressing meta.xml
> Compressing mimetype
> Compressing Pictures\content_1-Boxplot.png
> Compressing settings.xml
> Compressing styles.xml
> Compressing thumbnail.png
>
> Everything is Ok
> Copying odfWeave-test.odt
> Resetting wd
> Removing C:\DOCUME~1\Udo_2\LOCALS~1\Temp\Rtmp6QrXgk/odfWeave05190748330
>
> Done
>
> #######################################################################
> #Structure of the unzipped odf-document that produced the error message
>
> 05.07.2009 11:43 <DIR> Bitmaps
> 05.07.2009 19:07 13.820 content.xml
> 05.07.2009 11:43 0 current.xml
> 05.07.2009 11:43 <DIR> floater
> 05.07.2009 11:43 1.889 manifest.xml
> 05.07.2009 11:43 <DIR> menubar
> 05.07.2009 11:43 968 meta.xml
> 05.07.2009 11:43 39 mimetype
> 05.07.2009 22:18 <DIR> Pictures
> 05.07.2009 11:43 <DIR> popupmenu
> 05.07.2009 11:43 <DIR> progressbar
> 05.07.2009 11:43 7.993 settings.xml
> 05.07.2009 11:43 <DIR> statusbar
> 05.07.2009 19:07 13.281 styles.xml
> 05.07.2009 11:43 1.579 thumbnail.png
> 05.07.2009 11:43 <DIR> toolbar
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
More information about the R-help
mailing list