我们如何导出 ms-word(或 rtf)文档(从网络浏览器)以由 pl/sql 生成?

发布于 2024-08-16 10:20:47 字数 747 浏览 2 评论 0原文

我需要从 pl/sql 查询生成一个 ms-word 文档,以通过 Web 浏览器导出一组报告。

我一直在寻找一种使用 owa_util.mime_header 等修改内容标题的特定方法,但无法真正获得有效的概念证明来让网页向用户展示下载/打开/保存 ms-word 文档。

我知道这并不多,但是..

   begin
    OWA_UTIL.MIME_HEADER ( 'application/vnd.ms-word', false);
    htp.print('Content-Disposition:attachment;filename="test.doc"');
    OWA_UTIL.HTTP_HEADER_CLOSE;
        for x in (select first_column, second_column from my_table)
            loop
                htp.p(x.first_column||'<br/>'||x.second_column||'<br/><br/>');
            end loop;
    end;

有人可以解释一下如何创建一个生成 html 输出的程序,该程序拦截浏览器标头并将查询内容打印到 word 文档中吗?

顺便说一句,我正在运行的当前环境(限制): Oracle APEX 3.0.1(不是 3.1,我相信 3.1 具有导出到 Word 文档的功能)。

提前致谢。

I need to generate a ms-word document from a pl/sql query to export a set of reports through a web browser.

I have been searching for a specific way to modify the content headers using owa_util.mime_header etc etc but could not really get a working proof of concept to get the web page to present the user to download/open/save a ms-word document.

I know it's not much but..

   begin
    OWA_UTIL.MIME_HEADER ( 'application/vnd.ms-word', false);
    htp.print('Content-Disposition:attachment;filename="test.doc"');
    OWA_UTIL.HTTP_HEADER_CLOSE;
        for x in (select first_column, second_column from my_table)
            loop
                htp.p(x.first_column||'<br/>'||x.second_column||'<br/><br/>');
            end loop;
    end;

Could someone please shed some light on how can I create a procedure that generates output to html which intercept the browser headers and prints out the query content to a word document?

By the way, the current environment (restriction) I am running this from:
Oracle APEX 3.0.1 (not 3.1, which I believe has an export to word doc feature).

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

澉约 2024-08-23 10:20:47

在 Apex 中,您可以制作完全根据您的制作过程生成的页面:

  1. 创建空白页面。
  2. 进程下,单击创建,然后选择PL/SQL
  3. 为其命名,并保留默认选项“On Load - Before Header”。
  4. 对于 PL/SQL 页面进程,输入以下内容:

    <前><代码>开始
    我的程序;
    htmldb_application.g_unrecoverable_error := true;
    结尾;

  5. 创建您的过程(您拥有的代码应该可以正常工作)并且它应该可以正常工作。

    >

编辑:“myprocedure”中的代码应该发出 HTML 代码,包括 HTML 和 BODY 标记。

In Apex you can make a page that is completely generated from a procedure of your making:

  1. Create a blank page.
  2. Under Processes, click Create, and choose PL/SQL.
  3. Give it a name, and leave the default option "On Load - Before Header".
  4. For PL/SQL Page Process, enter the following:

    BEGIN
       myprocedure;
       htmldb_application.g_unrecoverable_error := true;
    END;
    
  5. Create your procedure (the code you have should work ok) and it should work fine.

EDIT: the code in "myprocedure" should emit HTML code, including the HTML and BODY tags.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文