Dear R and odfWeave users, I am trying to figure out how to control table width and alignment on the page for a table generated by odfTable. Based on reading odfWeave documentation (including formattingOut.odt), here is how I manipulate the styles: st = getStyleDefs() # modify the table style tab = getStyles()$table st[[tab]]$align = "center" # seems to have no effect st[[tab]]$marginLeft = "2.0 in" # seems to have no effect setStyleDefs(st) My table always ends up fully justified (taking all page width). When I check Table Format in the output .odf, Alignment is always "Automatic". When doing Column/Optimal Width on the table, the table shrinks but becomes left aligned, not centered. The table style is understood by odfWeave -- here is the output I get after sourcing my style definition file:> getStyles()$table[1] "RTable1"> getStyleDefs()[[getStyles()$table]]$type [1] "Table" $marginLeft [1] "2.0 in" $marginRight [1] "0.05in" $marginTop [1] "0.05in" $marginBottom [1] "0.05in" $align [1] "center" I am not sure why these style options do not seem to have effect on the output. My specific questions are: (1) How do I get table alignment to work? (2) Is the only way to control table width via setting the margins in the $table style? What am I doing wrong in the above style code? (3) What about column width -- is it possible to automatically size columns to fit the content, like selecting Column/Optimal Width but programmatically via odfWeave? Thank you, Aleksey [[alternative HTML version deleted]]
> I am trying to figure out how to control table width and alignment on the > page for a table generated by odfTable. Based on reading odfWeave > documentation (including formattingOut.odt), here is how I manipulate the > styles: >st = getStyleDefs() # modify the table style tab = getStyles()$table st[[tab]]$align = "center" ? ? ? ? ? ?# seems to have no effect st[[tab]]$marginLeft = "2.0 in" ? ? # seems to have no effect setStyleDefs(st)> > My table always ends up fully justified (taking all page width). When I > check Table Format in the output .odf, Alignment is always "Automatic". When > doing Column/Optimal Width on the table, the table shrinks but becomes left > aligned, not centered.It's hard to tell without an actual file to test with (and what versions of R and odfWeave, and what platform etc) Did you read the example files in the examples directory of the package? There are examples of what you are doing there and they seem to work (last time I checked at least). Can you you reproduce those example tables?> The table style is understood by odfWeave -- here is the output I get after > sourcing my style definition file: > >> getStyles()$table > [1] "RTable1" >> getStyleDefs()[[getStyles()$table]] > $type > [1] "Table" > > $marginLeft > [1] "2.0 in" > > $marginRight > [1] "0.05in" > > $marginTop > [1] "0.05in" > > $marginBottom > [1] "0.05in" > > $align > [1] "center" > > I am not sure why these style options do not seem to have effect on the > output. My specific questions are: > > (1) How do I get table alignment to work? > > (2) Is the only way to control table width via setting the margins in the > $table style? What am I doing wrong in the above style code?At present, yes.> (3) What about column width -- is it possible to automatically size columns > to fit the content, like selecting Column/Optimal Width but programmatically > via odfWeave?It is on my (neglected) list of things to do. We could provide an interface for users to specify the columns widths manually. I've experimented with figuring it out automatically and it is subject to the font specifications (obviously) and tricky. Max