Posted on 2010-01-19 01:28:43.93908-08 by kevinphilp
tabs
I have just started a project with oodoc and was wondering - how do I insert a tab in text. I have read in the xpath documents that tabstop "Returns a special tabulation mark element, available for insertion within an existing text" but how do I use it? Thanks Kevin.
Direct Responses: 12210 | Write a response
Posted on 2010-01-19 04:00:10.245792-08 by jmgdoc in response to 12208
Re: tabs

It depends on the precise need.

If you want to insert a text with tabs, through any method that creates a text element with a given content or that changes the text content of an existing element, you have just to put "\t" characters in the given string. Example:
$doc->appendParagraph(text => "Before \t after");

It's possible to append a tab stop, then an additional text, to an existing text element. To do so, you should combine tabStop() which creates a free tab stop element, and extendText(), in order to append a tab stop then a new text after the tab stop. Example (where $p is a previously selected paragraph):
$doc->extendText($p, $doc->tabStop); $doc->extendText($p, "after the tab stop");

In the last example, there is a alternative for the first instruction, thanks to appendTabStop(), so the sequence below does the same job:
$doc->appendTabStop($p); $doc->extendText($p, "after the tab stop");
Direct Responses: 12211 | Write a response
Posted on 2010-01-19 05:38:13.278876-08 by kevinphilp in response to 12210
Re: tabs
Thanks - that works great. I was making life too complex - adding \t was all I needed
Direct Responses: Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.