xml publisher笔记
2015-12-03 10:31 TRACEING 阅读(697) 评论(0) 编辑 收藏 举报模板文件对应的数据库表:
select * from xdo_lobs
动态打印图片
word模板中:
<?if:SHOW_TYPE=0?><fo:instream-foreign-object content-type="image/gif"><xsl:value-of select="FILE_DATA"/></fo:instream-foreign-object><?end if?>
主要是这段:<fo:instream-foreign-object content-type="image/gif"><xsl:value-of select="FILE_DATA"/></fo:instream-foreign-object>
图片在数据库中是以BLOB存储的,查出后需转换成CLOB
FUNCTION Get_Pictrue RETURN CLOB IS
l_Result CLOB;
l_Blob BLOB;
BEGIN
BEGIN
SELECT Fl.File_Data
INTO l_Blob
FROM Fnd_Attached_Documents Fad,
Fnd_Documents Fd,
Fnd_Lobs Fl,
Fnd_Document_Categories_Tl Dct
WHERE Dct.Category_Id = Fd.Category_Id
AND Dct.Language = Userenv('LANG')
AND Fl.File_Id = Fd.Media_Id
AND Fad.Document_Id = Fd.Document_Id
AND Fad.Entity_Name = 'CUX.CUX_QA_REPORT_HEADERS'
AND Fad.Pk1_Value = Gn_Header_Id
AND Dct.User_Name = 'QA:图片';
EXCEPTION
WHEN OTHERS THEN
RETURN NULL;
END;
Dbms_Lob.Createtemporary(Lob_Loc => l_Result, Cache => FALSE, Dur => 0);
Wf_Mail_Util.Encodeblob(l_Blob, l_Result);
RETURN(l_Result);
END Get_Pictrue;
打印时分行打印,3000字节一行
PROCEDURE Print_Picture IS
Ln_Start NUMBER;
Ln_Count NUMBER;
Lv_Show VARCHAR2(4000);
BEGIN
Ln_Count := 0;
Fnd_File.Put(Fnd_File.Output, '<FILE_DATA>');
LOOP
Ln_Start := Ln_Count * 3000 + 1;
Ln_Count := Ln_Count + 1;
SELECT Substr(Get_Pictrue, Ln_Start, 3000) File_Data
INTO Lv_Show
FROM Dual;
EXIT WHEN Lv_Show IS NULL;
Fnd_File.Put(Fnd_File.Output, Lv_Show);
END LOOP;
Fnd_File.Put(Fnd_File.Output, '</FILE_DATA>');
END Print_Picture;
注意:动态打印图片比较特殊,一定要把相应的窗体域放到For Each标签里面 (for-each HEMP),否则会报错:“java.lang.StringIndexOutOfBoundsException: String index out of range: -1”
“java.lang.StringIndexOutOfBoundsException: String index out of range: -1”这个错误的原因有两个:
1,图片的窗体域没放到for each标签里
2,如果是以下版本的话就需要打补丁。oracle官方的说法见 文档 ID 1251964.1
$COMMON_TOP/java/classes/oracle/dss/graph/version.txt
which will have something like the following:
ComponentBuildVersion=3.1.1.7.1
ComponentBuildMode=nondebug
Copyright=Copyright � 2001, 2008, Oracle. All rights reserved.
ComponentNumber=na
ReleaseDescription=BI Beans 3.1.1.x
The fixed version is: BI 3.1.1.7.2