From: Serge N. <Ser...@fr...> - 2011-10-21 18:58:41
|
Le 21/10/2011 11:40, Matt Keenan a écrit : > Serge, > > Thanks for the reply, I'm using OpenOffice 3.3.0 and as you say it defaults to using 1.2. > > I changed to use 1.0 as you suggest, and re-launched and opened my report but the problem still persists. > > Attached : > - descend-repoort-bad.png : shows the tabs in place where I'd really > prefer spaces and you can clearly see the alignment is out. > > Replacing the tabs for spaces, makes the alignment nice and clean. I don't agree. The ODF module generates the document as it is for others format. If we do that, the report will no be the same as pdf or rtf. All documents generate tabs. If we use tabs, this is for numbering which is not always constant in length. I have a png in copy. Perhaps you need to change how you write your report. If you send it to me, I can try to solve this. > > As the tab is hard coded by default it's always going to get printed in the report, and as I generally agree changing the paramaters to start_paragraph is not the way to go > > As Adam suggests one possible solutoin is to do a hard replacement when I open the ODF document for s/TAB/space/. I'd prefer a more automated solution. > > So can styles be used to achieve this ? Can you specify the location of tab stops in a style ? I'm a bit of a newb when it comes to styles so any advice much appreciated. We already use style. I create ODF styles depending on gramps style. > > cheers > > Matt > > On 10/20/11 20:15, Serge Noiraud wrote: >> Le 19/10/2011 13:35, Matt Keenan a écrit : >>> Hi, >>> >>> Attempting to write a custom Descendant Report with my preferred >>> output to date being ODF. >>> >>> However I'm seeing an issue where alignment is somewhat out because >>> ODF start_paragraph method by default puts a tab white space after >>> the leader (typically numbering system), if the leader is present. >> I have several questions to ask for that : >> Do you use libreoffice or openoffice ? >> What version ? >> >> I saw a similar problem with one report I wrote. >> It depends on the OO version. >> Gramps generate an ODT file based on the 1.0 ODF format. >> since several versions, the default document version for OO and LO is 1.2 >> so we may have this kind of problems. >> >> The solution for me was : >> >> OpenOffice or LibreOffice -> Tools -> Options -> Load/Save -> General -> ODF format >> Choose 1.0/1.1 >> >> Does it solve your problem ? >> >>> I'd like some means of overriding this tab to be a simple space >>> instead., the two most obvious means to achieve this are : >>> >>> 1. Change the default behaviour in >>> plugins/docgen/ODFDoc.py:start_paragraph() to simply print space >>> instead of TAB >>> >>> - self.cntnt.write(leader + '<text:tab/>') >>> + self.cntnt.write(leader + '<text: />') >>> >>> This would change the default behaviour for all ODF documents >>> produced, which admittedly I feel would most likely not >>> suit everybody. >>> >>> >>> 2. Provided a new optional paramater to the start_paragraph() method, >>> allowing for the custom provision of a leader_suffix >>> e.g. >>> >>> Index: plugins/docgen/ODFDoc.py >>> =================================================================== >>> --- plugins/docgen/ODFDoc.py (revision 18351) >>> +++ plugins/docgen/ODFDoc.py (working copy) >>> @@ -1473,7 +1473,7 @@ >>> """ >>> self.cntnt.write('</text:p>\n') >>> >>> - def start_paragraph(self, style_name, leader=None): >>> + def start_paragraph(self, style_name, leader=None, leader_suffix=None): >>> """ >>> open a new paragraph >>> """ >>> @@ -1493,7 +1493,10 @@ >>> ' text:outline-level="%s">' % str(self.level) >>> ) >>> if leader is not None: >>> - self.cntnt.write(leader + '<text:tab/>') >>> + if leader_suffix is not None: >>> + self.cntnt.write(leader + '<text:%s/>' % >>> (str(leader_suffix))) >>> + else: >>> + self.cntnt.write(leader + '<text:tab/>') >>> self.new_cell = 0 >>> >>> >>> In testing this works nicely for me, however changing this just ind >>> ODFDoc.py would not be right, ideally it would have >>> to be added everywhere in gramps where start_paragraph() is defined, >>> which in trunk is currently : >>> >>> gen/plug/docgen/textdoc.py >>> plugins/docgen/HtmlDoc.py >>> plugins/docgen/AsciiDoc.py >>> plugins/docgen/ODFDoc.py >>> plugins/docgen/RTFDoc.py >>> plugins/docgen/LaTeXDoc.py >>> plugins/lib/libcairodoc.py >>> docgen/TextBufDoc.py >>> >>> Wanted to ping the devel list to see if there is a better solution to >>> my conundrum... >>> >>> thoughts ? >>> >>> Matt |