excel報表解決方法(ebs)
長久以來,oracle執行的excel報表經常採用csv格式,使用者需要view output,然後另存為本地csv檔案,才能用excel開啟,而且不能保留excel格式,包括欄位長度,欄位格式掩碼,以及公式等。
因為專案需要excel檔案包含公式,所以採用以下方案解決。
(1)將格式template檔案在excel中製做,儲存時,選取XML Spreadsheet格式,生成xml 模板檔案,這樣這個檔案可以包含公式等。
(2)採用fnd_file.put_line方式將xml模板檔案輸出,資料列可以依據程式設計要求修改。
(3)建立concurrent program採用XML輸出方式。
(4)這樣使用者在view output時候,瀏覽器可以自動開啟這個excel檔案。
附上package原始碼,本例子在application 11.5.8,和本機excel 2003,ie6.0測試正常
一下為Sample函式包:
create or replace package TEST_XML_PKG is
procedure main(errbuf OUT VARCHAR2,
retcode OUT VARCHAR2);
end TEST_XML_PKG;
/
create or replace package body TEST_XML_PKG is
procedure main(errbuf OUT VARCHAR2,
retcode OUT VARCHAR2)
is
begin
fnd_file.put_line(fnd_file.output,'<?xml version="1.0"?>');
fnd_file.put_line(fnd_file.output,'<?mso-application progid="Excel.Sheet"?>');
fnd_file.put_line(fnd_file.output,'<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"');
fnd_file.put_line(fnd_file.output,' xmlns:o="urn:schemas-microsoft-com:office:office"');
fnd_file.put_line(fnd_file.output,' xmlns:x="urn:schemas-microsoft-com:office:excel"');
fnd_file.put_line(fnd_file.output,' xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"');
fnd_file.put_line(fnd_file.output,' xmlns:html="'">http://www.w3.org/TR/REC-html40">');
fnd_file.put_line(fnd_file.output,' <DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">');
fnd_file.put_line(fnd_file.output,' <Author>Authorised User</Author>');
fnd_file.put_line(fnd_file.output,' <LastAuthor>Authorised User</LastAuthor>');
fnd_file.put_line(fnd_file.output,' <Created>2005-01-26T07:43:18Z</Created>');
fnd_file.put_line(fnd_file.output,' <Company>test</Company>');
fnd_file.put_line(fnd_file.output,' <Version>11.6360</Version>');
fnd_file.put_line(fnd_file.output,' </DocumentProperties>');
fnd_file.put_line(fnd_file.output,' <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">');
fnd_file.put_line(fnd_file.output,' <WindowHeight>5070</WindowHeight>');
fnd_file.put_line(fnd_file.output,' <WindowWidth>10635</WindowWidth>');
fnd_file.put_line(fnd_file.output,' <WindowTopX>360</WindowTopX>');
fnd_file.put_line(fnd_file.output,' <WindowTopY>75</WindowTopY>');
fnd_file.put_line(fnd_file.output,' <ProtectStructure>False</ProtectStructure>');
fnd_file.put_line(fnd_file.output,' <ProtectWindows>False</ProtectWindows>');
fnd_file.put_line(fnd_file.output,' </ExcelWorkbook>');
fnd_file.put_line(fnd_file.output,' <Styles>');
fnd_file.put_line(fnd_file.output,' <Style. ss:ID="Default" ss:Name="Normal">');
fnd_file.put_line(fnd_file.output,' <Alignment ss:Vertical="Center"/>');
fnd_file.put_line(fnd_file.output,' <Borders/>');
fnd_file.put_line(fnd_file.output,' <Font ss:FontName="新細明體" x:Family="Roman" ss:Size="12"/>');
fnd_file.put_line(fnd_file.output,' <Interior/>');
fnd_file.put_line(fnd_file.output,' <NumberFormat/>');
fnd_file.put_line(fnd_file.output,' <Protection/>');
fnd_file.put_line(fnd_file.output,' </Style>');
fnd_file.put_line(fnd_file.output,' <Style. ss:ID="s21">');
fnd_file.put_line(fnd_file.output,' <Font ss:FontName="Arial Unicode MS" x:CharSet="134" x:Family="Swiss"');
fnd_file.put_line(fnd_file.output,' ss:Size="12"/>');
fnd_file.put_line(fnd_file.output,' </Style>');
fnd_file.put_line(fnd_file.output,' <Style. ss:ID="s22">');
fnd_file.put_line(fnd_file.output,' <Font ss:FontName="Arial Unicode MS" x:CharSet="134" x:Family="Swiss"');
fnd_file.put_line(fnd_file.output,' ss:Size="12" ss:Color="#FF0000"/>');
fnd_file.put_line(fnd_file.output,' </Style>');
fnd_file.put_line(fnd_file.output,' </Styles>');
fnd_file.put_line(fnd_file.output,' <Worksheet ss:Name="Sheet1">');
fnd_file.put_line(fnd_file.output,' <Table ss:ExpandedColumnCount="3" ss:ExpandedRowCount="1" x:FullColumns="1"');
fnd_file.put_line(fnd_file.output,' x:FullRows="1" ss:DefaultColumnWidth="54" ss:DefaultRowHeight="16.5">');
fnd_file.put_line(fnd_file.output,' <Row ss:Height="17.25">');
fnd_file.put_line(fnd_file.output,' <Cell ss:StyleID="s22"><Data ss:Type="Number">11</Data></Cell>');
fnd_file.put_line(fnd_file.output,' <Cell ss:StyleID="s21"><Data ss:Type="Number">4</Data></Cell>');
fnd_file.put_line(fnd_file.output,'<Cell ss:StyleID="s21" ss:Formula="=RC[-2]*RC[-1]"><Data ss:Type="Number">44</Data></Cell>');
fnd_file.put_line(fnd_file.output,' </Row>');
fnd_file.put_line(fnd_file.output,' </Table>');
fnd_file.put_line(fnd_file.output,' <WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">');
fnd_file.put_line(fnd_file.output,' <Print>');
fnd_file.put_line(fnd_file.output,' <ValidPrinterInfo/>');
fnd_file.put_line(fnd_file.output,' <PaperSizeIndex>9</PaperSizeIndex>');
fnd_file.put_line(fnd_file.output,' <HorizontalResolution>600</HorizontalResolution>');
fnd_file.put_line(fnd_file.output,' <VerticalResolution>0</VerticalResolution>');
fnd_file.put_line(fnd_file.output,' </Print>');
fnd_file.put_line(fnd_file.output,' <Selected/>');
fnd_file.put_line(fnd_file.output,' <Panes>');
fnd_file.put_line(fnd_file.output,' <Pane>');
fnd_file.put_line(fnd_file.output,' <Number>3</Number>');
fnd_file.put_line(fnd_file.output,' <ActiveCol>2</ActiveCol>');
fnd_file.put_line(fnd_file.output,' </Pane>');
fnd_file.put_line(fnd_file.output,' </Panes>');
fnd_file.put_line(fnd_file.output,' <ProtectObjects>False</ProtectObjects>');
fnd_file.put_line(fnd_file.output,' <ProtectScenarios>False</ProtectScenarios>');
fnd_file.put_line(fnd_file.output,' </WorksheetOptions>');
fnd_file.put_line(fnd_file.output,' </Worksheet>');
fnd_file.put_line(fnd_file.output,' <Worksheet ss:Name="Sheet2">');
fnd_file.put_line(fnd_file.output,' <Table ss:ExpandedColumnCount="0" ss:ExpandedRowCount="0" x:FullColumns="1"');
fnd_file.put_line(fnd_file.output,' x:FullRows="1" ss:DefaultColumnWidth="54" ss:DefaultRowHeight="16.5"/>');
fnd_file.put_line(fnd_file.output,' <WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">');
fnd_file.put_line(fnd_file.output,' <ProtectObjects>False</ProtectObjects>');
fnd_file.put_line(fnd_file.output,' <ProtectScenarios>False</ProtectScenarios>');
fnd_file.put_line(fnd_file.output,' </WorksheetOptions>');
fnd_file.put_line(fnd_file.output,' </Worksheet>');
fnd_file.put_line(fnd_file.output,' <Worksheet ss:Name="Sheet3">');
fnd_file.put_line(fnd_file.output,' <Table ss:ExpandedColumnCount="0" ss:ExpandedRowCount="0" x:FullColumns="1"');
fnd_file.put_line(fnd_file.output,' x:FullRows="1" ss:DefaultColumnWidth="54" ss:DefaultRowHeight="16.5"/>');
fnd_file.put_line(fnd_file.output,' <WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">');
fnd_file.put_line(fnd_file.output,' <ProtectObjects>False</ProtectObjects>');
fnd_file.put_line(fnd_file.output,' <ProtectScenarios>False</ProtectScenarios>');
fnd_file.put_line(fnd_file.output,' </WorksheetOptions>');
fnd_file.put_line(fnd_file.output,' </Worksheet>');
fnd_file.put_line(fnd_file.output,'</Workbook>');
end;
end TEST_XML_PKG;
/
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/11536986/viewspace-621193/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- java報表解決方案Java
- oracle 死鎖表解決方法Oracle
- delete 大表解決辦法delete
- Oracle 11gR2 用exp無法匯出空表解決方法Oracle
- SqlServer鎖表解鎖解決辦法SQLServer
- Web統計圖表解決方案 (轉)Web
- 想理解Python的列表解析嗎?Think in Excel or SQL.PythonExcelSQL
- Oracle表解鎖Oracle
- Oracle EBS 打中文補丁錯誤 的一個解決方法Oracle
- 資料庫分庫分表解決方案彙總資料庫
- Oracle 11g 匯出空表解決辦法Oracle
- 使用臨時表解決表衝突一例
- Sqlserver linked server指向Excel報錯編號為7399和7303的解決方法SQLServerExcel
- ORACLE EBS中掛一張報表Oracle
- ORACLE EBS R 12解決方案Oracle
- hpz420系統盤安裝win10無法刪除分割槽表解決方法Win10
- hive使用報錯解決方法Hive
- 在ASP程式中列印Excel報表的新方法 (轉)Excel
- SQL Server 匯出Excel有換行的解決方法SQLServerExcel
- javascript事件列表解說JavaScript事件
- 安裝ORACLE EBS LINUX 平臺上找不到SATA 硬碟的解決方法OracleLinux硬碟
- 在ORACLE EBS R12 使用 loadruner 報錯的問題解決的思路Oracle
- 幾個報錯的解決方法
- 用ExportToXls方法匯出到Excel就變成這樣一團的解決方法ExportExcel
- 【技術貼】每次開啟excel表格都會彈出新excel。book1.xls解決方法Excel
- EBS服務啟動報錯基本處理
- IE7.0 訪問ORACLE EBS 出現問題一般的解決方法Oracle
- EBS R12下WEBADI建立Excel2010文件WebExcel
- javascript事件列表解說[轉]JavaScript事件
- Win10系統下excel打不開的解決方法Win10Excel
- Excel檔案彈出隱私問題警告的解決方法Excel
- post方法下載excelExcel
- ceph叢集安裝報錯解決方法
- Awr報告停止收集的解決方法
- RAC: SRVCTL and VIPCA 命令報錯解決方法PCA
- MRTG生成首頁報錯解決方法
- DBMS_METADATA報錯解決方法
- EBS R12.1 FOR linux 資料庫監聽很慢的一個解決方法Linux資料庫