Home » Developer & Programmer » Reports & Discoverer » Printing tab character (Oracle Reports, 6i, Windows)
icon7.gif  Printing tab character [message #653284] Fri, 01 July 2016 00:32 Go to next message
1982Hashmi
Messages: 69
Registered: March 2011
Location: Islamabad
Member
I'm using following query in Report Builder. The character chr(9) is being printed as a space character instead of tab character. How may I print tab character?

SELECT '1)'||chr(9)||'Test paragraph' as para
FROM DUAL
Re: Printing tab character [message #653285 is a reply to message #653284] Fri, 01 July 2016 00:36 Go to previous messageGo to next message
Michel Cadot
Messages: 67439
Registered: March 2007
Location: Nanterre, France, http://...
Senior Member
Account Moderator

There is a tab character, how it is displayed/printed depends ONLY on the final device.

Re: Printing tab character [message #653292 is a reply to message #653285] Fri, 01 July 2016 01:07 Go to previous messageGo to next message
1982Hashmi
Messages: 69
Registered: March 2011
Location: Islamabad
Member
In Toad I am getting perfect result but Oracle Reports is not showing what's expected. How may I achieve this?
Re: Printing tab character [message #653310 is a reply to message #653292] Fri, 01 July 2016 05:47 Go to previous messageGo to next message
Littlefoot
Messages: 21608
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I don't know. Consider printing several spaces instead.
Re: Printing tab character [message #653360 is a reply to message #653310] Mon, 04 July 2016 01:52 Go to previous messageGo to next message
1982Hashmi
Messages: 69
Registered: March 2011
Location: Islamabad
Member
Printing spaces will change the indentation of paragraph serial numbers.
Re: Printing tab character [message #653371 is a reply to message #653360] Mon, 04 July 2016 04:25 Go to previous messageGo to next message
Littlefoot
Messages: 21608
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
TAB consists of several spaces. So, what difference does it make if you concatenate TAB character (which - in the following example - consists of 6 spaces) or 6 spaces themselves?
SQL> select '1)' ||chr(9) || 'Test' from dual;

'1)'||C
-------
1)      Test

SQL> select '1)' || lpad(' ', 6) || 'Test' from dual;

'1)'||LPAD('
------------
1)      Test

SQL>
Re: Printing tab character [message #653375 is a reply to message #653371] Mon, 04 July 2016 04:59 Go to previous messageGo to next message
cookiemonster
Messages: 13895
Registered: September 2008
Location: Rainy Manchester
Senior Member
Tab is in a sense a variable number of spaces (and even that's a simplification):
SQL> select  '1)' ||chr(9) || 'Test' as text, 'tab' as type from dual
union all
select '1)' || lpad(' ', 6) || 'Test', 'spaces' from dual;  2    3

TEXT         TYPE
------------ ------
1)      Test      tab
1)      Test spaces

SQL> select  '11)' ||chr(9) || 'Test' as text, 'tab' as type from dual
union all
select '11)' || lpad(' ', 6) || 'Test', 'spaces' from dual;  2    3

TEXT          TYPE
------------- ------
11)     Test      tab
11)      Test spaces

And that's with a fixed width font in sqlplus. What happens with a variable width font?
Re: Printing tab character [message #653396 is a reply to message #653375] Mon, 04 July 2016 10:49 Go to previous messageGo to next message
Littlefoot
Messages: 21608
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
As this topic continues Hashmi's previous one (Paragraph Identation) (why didn't we merge them?), I think that it just doesn't matter in this case because the output would (OK, *should*) be correct regardless you concatenate TAB or 5-6 spaces.

(Screenshot taken from the previous topic)

/forum/fa/13187/0/

Re: Printing tab character [message #653397 is a reply to message #653396] Mon, 04 July 2016 11:02 Go to previous messageGo to next message
cookiemonster
Messages: 13895
Registered: September 2008
Location: Rainy Manchester
Senior Member
Again, the output will only be correct if you use a fixed width font. Otherwise there is zero guarantee you can make spaces take the same space a tab would.
Unfortunately I have no idea why the tab isn't working
Re: Printing tab character [message #653405 is a reply to message #653397] Mon, 04 July 2016 15:00 Go to previous messageGo to next message
Littlefoot
Messages: 21608
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
Right; screenshot suggests Arial or Tahoma or similar proportional font. I'm not saying that Hashmi should try to find number of spaces which would look exactly as a TAB character. It would be OK if he sets, say, 10 Arial spaces at the beginning of each paragraph. These 10 spaces would still be 10 spaces in the second paragraph as well as in the third etc.

So, LF, don't be lazy, if you can't explain it with words, *show* it. So here you go: I created a table with two columns:
create table test 
(par  number,
 text varchar2(4000));
and inserted 3 paragraphs. Then I created a report whose query looks like this:
select 
  par || ')' || lpad(' ', 10) || text value
from test
order by par
As you can see, I concatenated 10 spaces. The result:

/forum/fa/13188/0/

See the yellow markings? Indentation is just the same, and I didn't use non-proportional font (such as Courier). If I did, the result would still be the same (although - obviously - looking differently):

/forum/fa/13189/0/

I believe it doesn't really matter whether indentation equals 0.8 cm or 1.3 cm. If it does, you'd have to try several options until you find the closest one.

I hope I managed to make the point. If not, oh well, I can't do any better, sorry.

P.S. TAB doesn't work for me either (Oracle 11g, Reports Builder 10g).
Re: Printing tab character [message #653406 is a reply to message #653405] Mon, 04 July 2016 15:11 Go to previous messageGo to next message
BlackSwan
Messages: 26745
Registered: January 2009
Location: SoCal
Senior Member
https://en.wikipedia.org/wiki/Samples_of_monospaced_typefaces
Re: Printing tab character [message #653422 is a reply to message #653406] Tue, 05 July 2016 03:29 Go to previous messageGo to next message
cookiemonster
Messages: 13895
Registered: September 2008
Location: Rainy Manchester
Senior Member
What you've got to think about is if there are 10 paragraphs. Numbers take the same space in most fonts so if you follow number) by a fixed number of spaces the text after that will always align. But spaces aren't the same width as numbers, so just taking a space off of the 10 line won't make it align with the 9 line.
Re: Printing tab character [message #653445 is a reply to message #653422] Tue, 05 July 2016 14:49 Go to previous messageGo to next message
Littlefoot
Messages: 21608
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
I tried to create a formula column which concatenates CHR(9) - no success.
Yet another formula column with a local variable which equals CHR(9) and concatenating the variable - no success either.
I Googled for it and found a lot of problems/questions, no answers at all.

Therefore, unless someone knows better, Hashmi has only two options: use spaces (and have some kind of indentation - not perfect, but indentation) or use TAB (or nothing) and have no indentation at all.

Quite simple.
Re: Printing tab character [message #653453 is a reply to message #653445] Wed, 06 July 2016 03:18 Go to previous messageGo to next message
cookiemonster
Messages: 13895
Registered: September 2008
Location: Rainy Manchester
Senior Member
I think the problem is that tab is something the display program has to have code to handle, since it doesn't have a fixed width and different programs give different levels of indentation. Just spotted that PL/SQL developer displays them as spaces but if you copy and paste into something else the tab is treated as a tab.
If you output the report as pdf I'd be very suprised if the tab didn't display properly.
Re: Printing tab character [message #653553 is a reply to message #653453] Mon, 11 July 2016 01:38 Go to previous messageGo to next message
1982Hashmi
Messages: 69
Registered: March 2011
Location: Islamabad
Member
I really appreciate efforts of senior members. Thank you very much.
Re: Printing tab character [message #653558 is a reply to message #653553] Mon, 11 July 2016 05:22 Go to previous messageGo to next message
Littlefoot
Messages: 21608
Registered: June 2005
Location: Croatia, Europe
Senior Member
Account Moderator
So, what did you finally do?
Re: Printing tab character [message #653593 is a reply to message #653558] Mon, 11 July 2016 22:47 Go to previous messageGo to next message
1982Hashmi
Messages: 69
Registered: March 2011
Location: Islamabad
Member
As it is not possible to indent paragraphs as per my requirement so I am using full block formatting instead. I'll try to convince my Mgt....
Re: Printing tab character [message #653824 is a reply to message #653292] Tue, 19 July 2016 08:58 Go to previous messageGo to next message
linlasj
Messages: 98
Registered: August 2005
Location: Linköping
Member
What did you get in Reports?
Re: Printing tab character [message #653832 is a reply to message #653824] Wed, 20 July 2016 00:02 Go to previous message
1982Hashmi
Messages: 69
Registered: March 2011
Location: Islamabad
Member
Similar output as @Littlefoot shown in his message.
Previous Topic: rep1401 Fetal PL/SQL error occured
Next Topic: reports engine crash
Goto Forum:
  


Current Time: Mon Oct 19 18:08:36 CDT 2020