如何在Oracle APEX页面的报表区域中使用HTML自定义列标题? [英] How do I customize column headers with HTML in a report region of an Oracle APEX page?

查看:1164
本文介绍了如何在Oracle APEX页面的报表区域中使用HTML自定义列标题?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

测试平台的范围: Oracle 11g XE,Oracle APEX版本4.0.2和4.2.5 我不喜欢在分配我的源查询或表/视图关联后分配给我的APEX报告的列标题。我如何改变它们?我可以添加特殊格式和嵌入代码(例如HTML十六进制,十进制或短代码)吗?



附加问题:如何保留这些格式在我运行下载或保存到csv操作时输出的文本值中输出代码? 解决方案

条件和特殊格式的Oracle APEX报告头



这是另一个SO帖子的一般扩展,它要求:如何有条件地更改APEX报告中的字段(列)名称。本Q& A解释更广泛地讲述了在Oracle APEX报告中找到的对象项目和属性的动态分配。本示例通过在报告列标题的文本中嵌入HTML代码来实现此目的。这应该是可搜索的,对更广泛的受众更有帮助。

解决的问题




  1. 如果您没有更改REPORT输出标题就像您最初得到的那样。
  2. 如何绕过APEX报表设计页面的初始限制:显示HTML代码和其他特殊文本格式命令 >。
  3. 如何使这些格式代码不会以文本格式(ascii,utf-8等).csv(逗号分隔值)导出显示。 b $ b

...让我们开始吧!

更改APEX报告输出标题:仅文本



尝试编辑报告区域定义: img src =https://i.stack.imgur.com/OA8qw.pngalt =APEX交互式报表头定义表单>



请注意,我可以


例如,页面项= P2_MY_TITLE 将表示为:& ; P2_MY_TITLE。







更改APEX报表输出标题: HTML格式与CSV输出切换



我遇到了一些问题,让Interactive和Classic报告在版本4.0.2上显示HTML格式的文本...本示例的其余部分是在APEX版本4.2.5上使用更新的实例完成的。这个例子是通过交互式报告完成的。



我定义了两页ITEMS: PX_DISPLAY_FORMAT PX_ID_COLUMN_HEADER 。前者只是一种便利,允许用户定义他们的意图是仅查看还是导出为CSV。选择合适的选项将动态设置显示报告的格式。



后一项: PX_ID_COLUMN_HEADER 用于ID列。我定义了一个简短的PL / SQL函数输出来决定显示什么。

 开始
if:P6_DISPLAY_FORMAT ='html-coded'
然后返回'à &安培; NBSP;&安培;复印;&安培; NBSP;&安培; aelig;';
else返回'MY_ID_COLUMN';
结束if;
END;




我使用这些代码来测试:




  • à(希腊字母阿拉伯数字) - 十进制值

  • & nbsp; (空间格式)

  • © (版权符号)

  • æ (像aesop,aeneid,faeroes那样冷静的a + e符号......)


    可能会注意到下一步:
    $ b


    这个函数可以通用化,列标题选项保存为表驱动数据等。 PX_ID_COLUMN_HEADER code>从 PX_DISPLAY_FORMAT 项目值中拉取,其他项目为其他列定义的项目值也一样。

    现在以两种模式显示最终产品的屏幕照片: b
    $ b

    仅查看(使用特殊HTML字符和格式)



    提示:在左侧最后一列查找ID列。





    CSV导出格式(仅限纯文本值)


    $ b

    [cross-refs: #csv #delimited报告#栏头 #html格式化]


    Scope of Platforms Tested: Oracle 11g XE, Oracle APEX Versions 4.0.2 and 4.2.5

    I don't like the column headers assigned to my APEX report after I assign my source query or table/view association. How do I change them? Can I add special formatting and embedded codes (e.g. HTML hex, decimal or short codes)?

    Additional Question: How do I keep these formatting codes out of the text values that are exported when I run a "download" or "save to csv" operation?

    解决方案

    Conditional and Special Formatting for Oracle APEX Report Headers

    This is a generalized expansion of another SO post which asks: How do I conditionally change the field (column) names on an APEX report. This Q&A explanation talks more generally about dynamic assignments of object items and attributes found on Oracle APEX reports. This example does this by embedding HTML codes within the text of report column headers. This should be searchable and more helpful to a wider audience.

    Issues Resolved

    1. How to change REPORT output headers if you don't like what you got initially.
    2. How to bypass the APEX report design page's initial limitation: Show HTML codes and other special text formatting commands.
    3. How to keep these formatting codes from showing up in a text-formatted (ascii, utf-8, etc) .csv (comma separated value) export.

    ... let's get going!

    Changing APEX Report Output Headers: Text Only

    Try editing the report region definition:

    Notice that I can also define a substitution value populated from a defined page item.

    For example, page item = P2_MY_TITLE would be represented by: &P2_MY_TITLE.


    Changing APEX Report Output Headers: HTML Format with CSV Output Toggle

    I encountered some problems with getting both Interactive and Classic reports to show HTML formatted text on Version 4.0.2... The rest of this example was done using a newer instance on APEX Version 4.2.5. This example was done using Interactive reports.

    I Defined two page ITEMS: PX_DISPLAY_FORMAT and PX_ID_COLUMN_HEADER. The former is just a convenience that allows users to define if their intent is to "VIEW ONLY" or to "EXPORT TO CSV". Choosing the appropriate option will dynamically set the format of the report displayed.

    The latter item: PX_ID_COLUMN_HEADER is for the ID column. I defined a short PL/SQL function output to decide what to display.

        BEGIN
           if :P6_DISPLAY_FORMAT = 'html-coded'
              then return 'à © æ';
           else return 'MY_ID_COLUMN';
           end if;
        END;
    

    I used these codes to test:

    • à (greek letter alpha) -- Decimal Value
    •   (space - formatting)
    • © (copyright symbol)
    • æ (that cool a + e symbol as in aesop, aeneid, faeroes...)

    It's probably noticeable that there is a next step:

    This function can be generalized, the column header choices kept as table driven data, etc. PX_ID_COLUMN_HEADER pulls from the PX_DISPLAY_FORMAT item value as could other items defined for the other columns.

    And now screen-pics of the final product in the two modes:

    VIEW ONLY (With Special HTML Characters and Formatting)

    Hint: Look for ID Column at the last column on the left.

    CSV EXPORT FORMAT (With Text Only Values)

    [cross-refs: #csv, #delimited reports, #column headers, #html formatting]

    这篇关于如何在Oracle APEX页面的报表区域中使用HTML自定义列标题?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆