Home » Developer & Programmer » Reports & Discoverer » Controlling Font-Size in HTML format (Reports 10g)
() 1 Vote
|
|
Re: Controlling Font-Size in HTML format [message #425915 is a reply to message #425054] |
Tue, 13 October 2009 01:25 |
deepankar_04
Messages: 29 Registered: August 2009 Location: Udaipur, Rajasthan, INDIA
|
Junior Member |
|
|
I have read about this problem somewhere, I just copy and paste it here....Also I successfully run report from modifying the below code as suited to me.
Just see and make a test report and try it as written below;
Quote:
SUMMARY OF KNOWN ISSUES/LIMITATIONS WITH HTML OUTPUT IN REPORTS
1. So create new test report in your Report Builder
2. Draw DummyField char(2000) placeholder on your report data model
3. Create simple query "select 'Hello world' Hello from dual" using report wizard
4. On report layout drop column header text and create instead field item F_Hello sourced on DummyField
5. Turn on "Yes" Contains HTML tags property for F_Hello
6. Insert next procedure into Report Builder program units section:
7. PROCEDURE SetFieldStyle(Text IN varchar2,
8. Font IN varchar2 := 'Arial',
9. FontSize IN number := 8,
10. FontWeight IN varchar2 := null, -- normal|bold
11. FontStyle IN varchar2 := null, -- normal|italic
12. FontColor IN varchar2 := 'black', -- black|red ..,
13. BgColor IN varchar2 := null,
14. BorderStyle IN varchar2 := null, -- solid
15. BorderColor IN varchar2 := null,
16. Border IN number := null,
17. BorderLeft IN number := null,
18. BorderRight IN number := null,
19. BorderTop IN number := null,
20. BorderBottom IN number := null) IS
21. HtmlStyle varchar2(2000);
22. procedure AddHtmlStyle(Code IN varchar2, Value IN varchar2) is
23. begin
24. if Value is not null then
25. HtmlStyle := HtmlStyle||Code||': '||Value||'; ';
26. end if;
27. end;
28.
29. BEGIN
30. if upper(SRW.Get_Value('DESFORMAT')) = 'HTML' then
31. HtmlStyle := '<p style="';
32. AddHtmlStyle('font-weight', FontWeight);
33. AddHtmlStyle('font-style', FontStyle);
34. AddHtmlStyle('background-color', BgColor);
35. AddHtmlStyle('border-color', BorderColor);
36. if nvl(Border, 0) > 0 then
37. AddHtmlStyle('border-style: '||BorderStyle||'; border-width', Border);
38. else
39. AddHtmlStyle('border-left-style: '||BorderStyle||'; border-left-width', BorderLeft);
40. AddHtmlStyle('border-right-style: '||BorderStyle||'; border-right-width', BorderRight);
41. AddHtmlStyle('border-top-style: '||BorderStyle||'; border-top-width', BorderTop);
42. AddHtmlStyle('border-bottom-style: '||BorderStyle||'; border-bottom-width', BorderBottom);
43. end if;
44. HtmlStyle := HtmlStyle||'"><font';
45. if FontSize <= 8 then
46. HtmlStyle := HtmlStyle||' size=1';
47. elsif FontSize <= 10 then
48. HtmlStyle := HtmlStyle||' size=2';
49. elsif FontSize <= 12 then
50. HtmlStyle := HtmlStyle||' size=3';
51. elsif FontSize <= 14 then
52. HtmlStyle := HtmlStyle||' size=4';
53. elsif FontSize <= 18 then
54. HtmlStyle := HtmlStyle||' size=5';
55. elsif FontSize <= 24 then
56. HtmlStyle := HtmlStyle||' size=6';
57. elsif FontSize > 24 then
58. HtmlStyle := HtmlStyle||' size=7';
59. end if;
60. if Font is not null then
61. HtmlStyle := HtmlStyle||' face="'||Font||'"';
62. end if;
63. if FontColor is not null then
64. HtmlStyle := HtmlStyle||' color="'||FontColor||'"';
65. end if;
66. HtmlStyle := HtmlStyle||'>'||replace(Text, chr(10), '<BR>')||'</font>';
67. srw.set_field_char(0, HtmlStyle);
68.
69. else
70. HtmlStyle := Text;
71. if Font is not null then
72. SRW.set_font_face(font);
73. end if;
74. if FontSize is not null then
75. SRW.set_font_size(FontSize);
76. end if;
77. if lower(FontWeight) = 'bold' then
78. SRW.set_font_weight(SRW.DEMIBOLD_WEIGHT);
79. else
80. SRW.set_font_weight(SRW.MEDIUM_WEIGHT);
81. end if;
82. if lower(FontStyle) = 'italic' then
83. SRW.set_font_style(SRW.ITALIC_STYLE);
84. end if;
85. -- you may generate The Oracle CDE1 colors from #XXXXXX syntax here
86. if lower(FontColor) not like '#%' then
87. SRW.set_text_color(FontColor);
88. end if;
89. if lower(BgColor) not like '#%' then
90. SRW.set_background_fill_color(BgColor);
91. end if;
92. if nvl(Border, 0) > 0 then
93. SRW.set_border_width(Border);
94. if BorderStyle is not null then
95. SRW.set_border_pattern(BorderStyle);
96. end if;
97. if lower(BorderColor) not like '#%' then
98. SRW.set_foreground_border_color(BorderColor);
99. end if;
100. end if;
101. srw.set_field_char(0, Text);
102. end if;
103. END;
104. Insert next format trigger on F_Hello item:
105. FUNCTION F_1FormatTrigger return boolean is
106. BEGIN
107. SetFieldStyle('Say Hello',
108. FontWeight => 'Bold',
109. FontStyle => 'Italic',
110. FontColor => 'blue',
111. BgColor => 'gray',
112. Border => 1,
113. BorderStyle => 'solid',
114. BorderColor => 'red');
115. return (TRUE);
116. END;
Quote:
Hope it works fine to you
|
|
|
Goto Forum:
Current Time: Thu Jan 23 13:37:42 CST 2025
|