Generate XSLT file using XML
Hi All,
How to generate XSLT file based on the below xml
<Employees>
<Employee EmployeeID="1">
<FirstName>Guy</FirstName>
<LastName>Gilbert</LastName>
<Address>
<AddressLine1>7726 Driftwood Drive</AddressLine1>
<City>Monroe</City>
<StateOrProvince>WA </StateOrProvince>
<PostalCode>98272</PostalCode>
</Address>
</Employee>
<Employee EmployeeID="2">
<FirstName>Kevin</FirstName>
<LastName>Brown</LastName>
<Address>
<AddressLine1>7883 Missing Canyon Court</AddressLine1>
<City>Everett</City>
<StateOrProvince>WA </StateOrProvince>
<PostalCode>98201</PostalCode>
</Address>
</Employee>
</Employees>and also like to know how to query whole employees details using SQl Query?Thanks in advance-DS
Hi Karthi,
Regarding your description, to achieve your requirement you can reference the below code.
--create schema collection
CREATE XML SCHEMA COLLECTION EmployeeSchema AS '
<schema xmlns="http://www.w3.org/2001/XMLSchema">
<element name="Employees" >
<complexType>
<sequence>
<element name="Employee" minOccurs="0" maxOccurs="unbounded">
<complexType>
<sequence>
<element name="FirstName" minOccurs="1" maxOccurs="1" />
<element name="LastName" minOccurs="1" maxOccurs="1" />
<element name="Address" minOccurs="1" maxOccurs="1" >
<complexType>
<sequence>
<element name="AddressLine1" type="string" />
<element name="City" type="string" />
<element name="StateOrProvince" type="string" />
<element name="PostalCode" type="string" />
</sequence>
</complexType>
</element>
</sequence>
<attribute name="EmployeeID" type="string" use="required" />
</complexType>
</element>
</sequence>
</complexType>
</element>
</schema>'
--Validating an XML variable
DECLARE @xmlDoc XML(EmployeeSchema);
SET @xmlDoc =
'<Employees>
<Employee EmployeeID="1">
<FirstName>Guy</FirstName>
<LastName>Gilbert</LastName>
<Address>
<AddressLine1>7726 Driftwood Drive</AddressLine1>
<City>Monroe</City>
<StateOrProvince>WA </StateOrProvince>
<PostalCode>98272</PostalCode>
</Address>
</Employee>
<Employee EmployeeID="2">
<FirstName>Kevin</FirstName>
<LastName>Brown</LastName>
<Address>
<AddressLine1>7883 Missing Canyon Court</AddressLine1>
<City>Everett</City>
<StateOrProvince>WA </StateOrProvince>
<PostalCode>98201</PostalCode>
</Address>
</Employee>
</Employees>'
--how to query whole employees details
SELECT T.N.value('@EmployeeID[1]','INT') AS EmployeeID,
T.N.value('(FirstName)[1]', 'nvarchar(max)') AS FirstName,
T.N.value('(LastName)[1]', 'nvarchar(max)') AS LastName,
T.N.value('(Address/AddressLine1)[1]', 'nvarchar(max)') AS AddressLine1,
T.N.value('(Address/City)[1]', 'nvarchar(max)') AS city,
T.N.value('(Address/PostalCode)[1]', 'nvarchar(max)') AS PostalCode
FROM @xmlDoc.nodes('/Employees/Employee') AS T(N)
If you have any question, feel free to let me know.
Eric Zhang
TechNet Community Support
Similar Messages
-
How to generate MT100 file in XML ?
How to generate MT100 file in XML ?
Dear All,
Base: We are working on ECC 6.0 version and developing B2B with bank.
Requirement: For B2B bank requires payment orders in MT100 format wrapped in XML.
At Present: I am using PMW format MT100(standard) in payment method. With the use of this format system is generating MT100 text file.
In this standard PMW format MT100, check box for u201Dmapping using DME engineu201D is not selected.
My Try: I change in format output from file to XML in Payment Media Format (T. Code OBPM1), but it doesnu2019t work.
In data medium display (T. Code FDTA) system is showing the following error.
The XML page cannot be displayed
Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.
XML document must have a top level element. Error processing resource 'file:///C:/Users/888881/AppData/Local/Microsoft/Wind...
In view source system is showing only this,
<?xml version="1.0" encoding="utf-8"?>
My Question: How to generate MT100 file in XML ?
Should I have to create DME Format Tree in ( T. Code DMEE ) and create new Payment Media Format (T. Code OBPM1), with the mapping using DME engine ?
Please give your valuable suggesions,
Thank you,
RonyHi Prabhu,
The program SAPFPAYM generates the payment Medium on the basis of your configuration and background settings, this program does not bydefault give the output in the XML.
Varient creation for the PMW in T. Code OBPM4, use the same program, which i already done it, even without this it is not be possible to create any payment Medium.
Regards,
Rony -
Getting error while running the XML file using XML Publisher Desktop
Hi all,
We have successfully loaded the XML file using XML Publisher Desktop. But when we preview the same using PDF format we are getting the following error.
Font Dir: C:\Program Files\Oracle\XML Publisher Desktop\Template Builder for Word\fonts
Run XDO Start
RTFProcessor setLocale: en-us
FOProcessor setData: C:\Documents and Settings\smanmadh\Desktop\ProductCompensationDT.xml
FOProcessor setLocale: en-us
java.lang.NullPointerException
at oracle.apps.xdo.template.fo.area.PageNumber.formatString(PageNumber.java:104)
at oracle.apps.xdo.template.fo.IDManager.registerId(IDManager.java:44)
at oracle.apps.xdo.template.fo.area.AreaTree.registerLastPageJoinSeq(AreaTree.java:1106)
at oracle.apps.xdo.template.fo.area.AreaTree.incrementJoinSequenceIndex(AreaTree.java:219)
at oracle.apps.xdo.template.fo.area.AreaTree.registerLastPageDocument(AreaTree.java:1089)
at oracle.apps.xdo.template.fo.area.AreaTree.forceOutput(AreaTree.java:471)
at oracle.apps.xdo.template.fo.elements.FORoot.end(FORoot.java:58)
at oracle.apps.xdo.template.fo.FOHandler.endElement(FOHandler.java:386)
at oracle.xml.parser.v2.XMLContentHandler.endElement(XMLContentHandler.java:196)
at oracle.xml.parser.v2.NonValidatingParser.parseElement(NonValidatingParser.java:1212)
at oracle.xml.parser.v2.NonValidatingParser.parseRootElement(NonValidatingParser.java:301)
at oracle.xml.parser.v2.NonValidatingParser.parseDocument(NonValidatingParser.java:268)
at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:149)
at oracle.apps.xdo.template.fo.FOProcessingEngine.process(FOProcessingEngine.java:279)
at oracle.apps.xdo.template.FOProcessor.generate(FOProcessor.java:1022)
at RTF2PDF.runRTFto(RTF2PDF.java:626)
at RTF2PDF.runXDO(RTF2PDF.java:460)
at RTF2PDF.main(RTF2PDF.java:251)
Thanks in Advance.
Sudeep.This is BI related. You will get a quicker answer from the BI Publisher forum
BI Publisher -
Error while running the XML file using XML Publisher Desktop
Hi All,
We have successfully loaded the XML file using XML Publisher Desktop.But when we try to preview it using the PDF format we are getting the following error.
Font Dir: C:\Program Files\Oracle\XML Publisher Desktop\Template Builder for Word\fonts
Run XDO Start
RTFProcessor setLocale: en-us
FOProcessor setData: C:\Documents and Settings\smanmadh\Desktop\ProductCompensationDT.xml
FOProcessor setLocale: en-us
java.lang.NullPointerException
at oracle.apps.xdo.template.fo.area.PageNumber.formatString(PageNumber.java:104)
at oracle.apps.xdo.template.fo.IDManager.registerId(IDManager.java:44)
at oracle.apps.xdo.template.fo.area.AreaTree.registerLastPageJoinSeq(AreaTree.java:1106)
at oracle.apps.xdo.template.fo.area.AreaTree.incrementJoinSequenceIndex(AreaTree.java:219)
at oracle.apps.xdo.template.fo.area.AreaTree.registerLastPageDocument(AreaTree.java:1089)
at oracle.apps.xdo.template.fo.area.AreaTree.forceOutput(AreaTree.java:471)
at oracle.apps.xdo.template.fo.elements.FORoot.end(FORoot.java:58)
at oracle.apps.xdo.template.fo.FOHandler.endElement(FOHandler.java:386)
at oracle.xml.parser.v2.XMLContentHandler.endElement(XMLContentHandler.java:196)
at oracle.xml.parser.v2.NonValidatingParser.parseElement(NonValidatingParser.java:1212)
at oracle.xml.parser.v2.NonValidatingParser.parseRootElement(NonValidatingParser.java:301)
at oracle.xml.parser.v2.NonValidatingParser.parseDocument(NonValidatingParser.java:268)
at oracle.xml.parser.v2.XMLParser.parse(XMLParser.java:149)
at oracle.apps.xdo.template.fo.FOProcessingEngine.process(FOProcessingEngine.java:279)
at oracle.apps.xdo.template.FOProcessor.generate(FOProcessor.java:1022)
at RTF2PDF.runRTFto(RTF2PDF.java:626)
at RTF2PDF.runXDO(RTF2PDF.java:460)
at RTF2PDF.main(RTF2PDF.java:251)
Any pointers will be of great help.
Thanks in Advance
Sudeep.2¢
I had a similar error which when I searched, came up with this thread.
My issue was resolved after I discovered that my RTF template was not really RTF. It was sill in MS Word DOC format. This was discovered by reviewing two templates in NOTEPAD. The MS-DOC files have a lot of "special" characters in them. My RTF was not really RTF.
After doing a SAVE AS - RTF format, then the preview worked as expected.
Just Sharing...
--Tim -
How to generate .java file from xml?
Does anyone have an idea of how i can generate .java file from xml file? Tools like jakrata digester, JOX are there but both of them are useful in populating java beans from xml. My requirement is to generate .java file from .xml with getters and setters methods for xml elements/attributes. I also tried JAXB. But JAXB generates bunch of files and most of them are interfaces, which is not going to work for me.
For e.g. i have following xml file and i want to generate Address.java file with getters/setters. Any ideas?
<?xml version='1.0' encoding='UTF-8' ?>
<Address>
<FirstName type="String"/>
<PoBox type="int"/>
</Address>
Thanks,
VickyCrosspost.
http://forum.java.sun.com/thread.jsp?thread=475564&forum=4&message=2205846 -
How to generate XSD file for XML schema adobe form
Hi,
I want to generate XSD file for XML schema interfaces adobe forms. How can I do it. Where I can do it..or who will provide this file..
Thanks
Ram
Edited by: Ramesh ram on Feb 23, 2010 6:33 PMAaaaah, my mistake, sorry for that. Of course you should use the XML interface and I forgot it is not described in this tutorial. You can easily find another one where the XML based interface is used. But... you won´t need any tutorial. just create a WD context. Place a Interactive form element on your WD app screen, in the attributes you need to maintain the form template name. If you write a name suitable for you which no existing forms uses, the system will offer you to generate a XML based interface and right after that it will "send" you to the SFP transaction. That means you can like skipi the step defining the interface because it it is generated automatically and you only draw the layout for this generated interface.
You should use XMl based interface for your WD app, because when using the ABAP dic based, some features are not available (I am not sure, but ABAP based works only for print form or something).
Hope it is all clear now,
have a nice day,
Otto -
Generating text file using PL/SQL
can any body send sample program how to generate text file using PL/SQL program.I want to store table data into that text file.
Hi,
try this.
Thanks
CREATE OR REPLACE procedure write_index (TABLE_NAME_ACCEPT VARCHAR2) IS
id UTL_FILE.FILE_TYPE;
name VARCHAR2(20) := 'e:\db_coca\input';
err VARCHAR2(100);
ColNameLength Integer;
NumberoFColumns Integer;
num NUMBER;
i integer;
loc_query VARCHAR2(2000);
cursor_name INTEGER;
ret INTEGER;
l_const_name VARCHAR2(30);
CURSOR c_columns(i_Constraint_name VARCHAR2) IS
SELECT *
FROM all_cons_columns
WHERE CONSTRAINT_NAME = i_Constraint_name
order by table_name;
BEGIN
DBMS_OUTPUT.PUT_LINE('BEFORe OPEN');
--id := UTL_FILE.FOPEN('e:\db_coca\input',name,'w');
--IF UTL_FILE.IS_OPEN(id) THEN
-- DBMS_OUTPUT.PUT_LINE('Opened');
--ELSE
-- DBMS_OUTPUT.PUT_LINE('Still Closed');
--END IF;
DBMS_OUTPUT.PUT_LINE('AFTER OPEN');
--The table generation script
loc_query := 'Select CONSTRAINT_NAME from user_constraints ';
loc_query := loc_query || ' where owner = ' || '''CPS''';
loc_query := loc_query || ' AND CONSTRAINT_TYPE = ' || '''P''';
dbms_output.put_line('TABLE_NAME_ACCEPT = ' || TABLE_NAME_ACCEPT);
IF NOT (TABLE_NAME_ACCEPT IS NULL ) THEN
loc_query := loc_query || ' AND TABLE_NAME like ''';
loc_query := loc_query || TABLE_NAME_ACCEPT ;
loc_query := loc_query || '''';
END IF;
cursor_name := DBMS_SQL.OPEN_CURSOR;
dbms_output.put_line('Query = ' || loc_query);
DBMS_SQL.PARSE(cursor_name, loc_query, DBMS_SQL.v7);
dbms_output.put_line('After parse');
dbms_sql.DEFINE_COLUMN(cursor_name, 1,l_const_name, 30);
ret := DBMS_SQL.EXECUTE(cursor_name);
-- IF ret > 0 THEN
LOOP
dbms_output.put_line('return = ' || ret);
IF DBMS_SQL.FETCH_ROWS(cursor_name) > 0 THEN
dbms_sql.COLUMN_VALUE(cursor_name, 1,l_const_name);
-- dbms_sql.BIND_VARIABLE(cursor_name,
l_const_name,CONSTRAINT_NAME);
-- FOR C10 in Table_Loop Loop --The cursor
for the table name
Select COunt(*) INTO NumberoFColumns from
all_cons_columns
Where CONSTRAINT_NAME = l_const_name;
-- FOR C11 IN c_columns(l_const_name) LOOP
-- End loop;
-- UTL_FILE.PUT(id, ');');
ELSE EXIT;
END if; --THe 1 st cursor if is closed
End Loop; --The table loop ends here
DBMS_SQL.CLOSE_CURSOR(cursor_name);
-- END IF;
-- UTL_FILE.PUT_LINE(id,name);
-- UTL_FILE.PUT(id,'It worked and wrote to this file');
UTL_FILE.FCLOSE(id);
DBMS_OUTPUT.PUT_LINE('Successful write to file');
EXCEPTION
WHEN OTHERS THEN
err := SQLERRM;
num := SQLCODE;
DBMS_OUTPUT.PUT_LINE(err);
DBMS_OUTPUT.PUT_LINE(num);
DBMS_OUTPUT.PUT_LINE('Error in writing to file');
END write_index; -
How to generate multiple sheets using xml publisher
Hi,
how to generate multiple sheets using xml publisher.
Thanks,
Nurhttp://lmgtfy.com/?q=how+to+generate+multiple+sheets+using+xml+publisher
-
Generating excel files using XSLT mapping
Hi All,
I am working on a proxy to file scenario and we have a requirement of generating .xls file in a spreadsheet format at FTP server.I have done xslt mappping for creating the excel file in spreadsheet.But getting following error in channel monitoring.
Message processing failed. Cause: com.sap.engine.interfaces.messaging.api.exception.MessagingException: Error occurred while connecting to the FTP server "phmysa-s3006.ap.novartis.net:21": java.lang.Exception: Exception in XML Parser (format problem?):'java.lang.Exception: Message processing failed in XML parser: 'Conversion configuration error: Unknown structure 'Workbook' found in document', probably configuration error in file adapter (XML parser error)'
XSLT Code Used:
<?xml version='1.0' ?>
<?mso-application progid="Excel.Sheet"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:html="http://www.w3.org/TR/REC-html40">
<xsl:template match="DT_StockReports/*">
<Row>
<Cell>
<Data ss:Type="String">
<xsl:apply-templates/>
</Data>
</Cell>
</Row>
</xsl:template>
<xsl:template match="/">
<Workbook>
<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
</DocumentProperties>
<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
<WindowHeight>10365</WindowHeight>
<WindowWidth>13260</WindowWidth>
<WindowTopX>120</WindowTopX>
<WindowTopY>60</WindowTopY>
<ProtectStructure>False</ProtectStructure>
<ProtectWindows>False</ProtectWindows>
</ExcelWorkbook>
<Styles>
<Style ss:ID="Default" ss:Name="Normal">
<Alignment ss:Vertical="Bottom"/>
<Borders/>
<Font x:CharSet="512"/>
<Interior/>
<NumberFormat/>
<Protection/>
</Style>
</Styles>
<Worksheet ss:Name="">
<Table ss:ExpandedColumnCount="40" ss:ExpandedRowCount="15000" x:FullColumns="40"
x:FullRows="15000">
<xsl:apply-templates/>
</Table>
<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
<PageSetup>
<PageMargins x:Bottom="0.984251969" x:Left="0.78740157499999996"
x:Right="0.78740157499999996" x:Top="0.984251969"/>
</PageSetup>
<Selected/>
<Panes>
<Pane>
<Number>40</Number>
<ActiveRow>40</ActiveRow>
<ActiveCol>15000</ActiveCol>
</Pane>
</Panes>
<ProtectObjects>False</ProtectObjects>
<ProtectScenarios>False</ProtectScenarios>
</WorksheetOptions>
</Worksheet>
</Workbook>
</xsl:template>
</xsl:stylesheet>
Thanks
AyuraInput xml:
<?xml version="1.0" encoding="utf-8"?><n0:MT_StockReports xmlns:n0="urn:novartis.com:pi:ph:sp:LM_DD_501_LSP_L0X:StockReports" xmlns:prx="urn:sap.com:proxy:Q75:/1SAI/TASEF7C5F005BC07ECC0997:700:2008/06/25"><Header><Material></Material><MaterialDescription></MaterialDescription><MType></MType><Bin></Bin><Unit></Unit><MS></MS><LS></LS><Type></Type><PGr></PGr><ABC></ABC><Crcy></Crcy><Prc></Prc><Vendor></Vendor><VendorName></VendorName><VendMat></VendMat><ManufacturingPartN></ManufacturingPartN><Batch></Batch><BatchExpiryDate></BatchExpiryDate><Unrestr></Unrestr><SafetyStk></SafetyStk><MinSafStck></MinSafStck><MinLotSize></MinLotSize><MaxLotSize></MaxLotSize><MaxLevel></MaxLevel><ReorderPt></ReorderPt><TotalStock></TotalStock><TotalVal></TotalVal></Header><Records><Material>20001</Material><MaterialDescription>SIEVED NATEGLINIDE / DS.01 / DR</MaterialDescription><MType>ZPI</MType><Bin></Bin><Unit>KG</Unit><MS>40</MS><LS>HB</LS><Type>M0</Type><PGr>S01</PGr><ABC></ABC><Crcy>SGD</Crcy><Prc>S</Prc><Vendor> </Vendor><VendorName></VendorName><VendMat></VendMat><ManufacturingPartN></ManufacturingPartN><Batch>SD0026</Batch><BatchExpiryDate>01.12.2011</BatchExpiryDate><Unrestr>49.803 </Unrestr><SafetyStk>0.000 </SafetyStk><MinSafStck>0.000 </MinSafStck><MinLotSize>110.000 </MinLotSize><MaxLotSize>550.000 </MaxLotSize><MaxLevel>1.000 </MaxLevel><ReorderPt>0.000 </ReorderPt><TotalStock>49.803 </TotalStock><TotalVal>1723.18 </TotalVal></Records></n0:MT_StockReports>
Edited by: Ayura Kanungo on Dec 28, 2011 7:11 AM -
Generating PDF file using FOP API in Web Dynpro
Hi experts,
I would like to generate PDF files from a WebDynpro application without using Adobe Interactive forms.
I think that I can export context data to XML stream and then apply XSLT transformation to produce XSLFO format and then pass it to xlfo processor i.e FOP to generate the PDF file.
Has someone already try this way of generating PDF files?
Is it a good way of processing ?
Thanks in advance.
Thomas.hi Thomas,
You can make use of the iText API to create pdf documents through webdynpro.
For this you'll have to download the Itext api jar file.
Right click your webdynpro project include this jar file using the 'add external jar files'.Now you'll be able to make use of this api in your webdynpro project.
http://javaboutique.internet.com/tutorials/iText/ .
The above link will help you in using iText API.
hope this one helps you.
Regards,
Rahul. -
Generating Excel file using PL/SQL
Hi,
I wanted to generate the excel file using the below pasted PL/SQL which I have downloaded from one of the tech sites. And as I have very limited knowledge about PL/SQL I really dont know how & where I should compile this below mentioned code and get the desired O/P?
Please reply me ASAP if anybody can help me with this?
Please see the below code and please help me to interpret the same.
CREATE OR REPLACE PACKAGE gen_xl_xml IS
-- Version 0.5
-- Objective : The main objective OF this PACKAGE IS TO CREATE excel files from PL/SQL code
-- Requirement : Excel version 2003 onwards support XML format.
-- The procedures does have TO be called IN specific order at this moment.
-- expected SEQUENCE AS OF now IS
-- At first call create_file -> It creates a FILE WITH NAME that you pass AS parameter. This PROCEDURE writes the
-- excel file header AND some basic requirments like default style.
-- procedures 1. create_style , create_worksheet AND write_cell can be used IN ANY SEQUENCE AS many
-- times AS you need.
-- When done WITH writing TO FILE call the PROCEDURE close_file
-- CLOSE FILE --> This will actually flush the data INTO the worksheet(s) one BY one and then close the file.
-- What colors I can use ?
-- red , blue , green, gray , YELLOW, BROWN , PINK . lightgray ,
debug_flag BOOLEAN := TRUE ;
PROCEDURE create_excel( p_directory IN VARCHAR2 DEFAULT NULL , p_file_name IN VARCHAR2 DEFAULT NULL ) ;
PROCEDURE create_excel_apps ;
PROCEDURE create_style( p_style_name IN VARCHAR2
, p_fontname IN VARCHAR2 DEFAULT NULL
, p_fontcolor IN VARCHAR2 DEFAULT 'Black'
, p_fontsize IN NUMBER DEFAULT null
, p_bold IN BOOLEAN DEFAULT FALSE
, p_italic IN BOOLEAN DEFAULT FALSE
, p_underline IN VARCHAR2 DEFAULT NULL
, p_backcolor IN VARCHAR2 DEFAULT NULL );
PROCEDURE close_file ;
PROCEDURE create_worksheet( p_worksheet_name IN VARCHAR2 ) ;
PROCEDURE write_cell_num(p_row NUMBER , p_column NUMBER, p_worksheet_name IN VARCHAR2, p_value IN NUMBER , p_style IN VARCHAR2 DEFAULT NULL );
PROCEDURE write_cell_char(p_row NUMBER, p_column NUMBER, p_worksheet_name IN VARCHAR2, p_value IN VARCHAR2, p_style IN VARCHAR2 DEFAULT NULL );
PROCEDURE write_cell_null(p_row NUMBER , p_column NUMBER , p_worksheet_name IN VARCHAR2, p_style IN VARCHAR2 );
PROCEDURE set_row_height( p_row IN NUMBER , p_height IN NUMBER, p_worksheet IN VARCHAR2 ) ;
PROCEDURE set_column_width( p_column IN NUMBER , p_width IN NUMBER , p_worksheet IN VARCHAR2 ) ;
END ;
-- Package : gen_xl_sml
-- Version : 0.62
CREATE OR REPLACE PACKAGE Body gen_xl_xml IS
-- worksheets must be created before it could be passed AS parameter TO the write cell procedures
l_file utl_FILE.file_type ;
g_apps_env VARCHAR2(1) := 'U' ; -- unset at the start
TYPE tbl_excel_data IS TABLE OF VARCHAR2(2000) INDEX BY BINARY_INTEGER ;
g_excel_data tbl_excel_data ;
g_null_data tbl_excel_data ;
g_data_count NUMBER ;
TYPE rec_styles IS record ( s VARCHAR2(30) , def VARCHAR2(2000) );
TYPE tbl_style IS TABLE OF rec_styles INDEX BY BINARY_INTEGER ;
g_styles tbl_style ;
g_null_styles tbl_style ;
g_style_count NUMBER := 0;
TYPE rec_worksheets IS record ( w VARCHAR2(30) , whdr VARCHAR2(300), wftr VARCHAR2(2000) );
TYPE tbl_worksheets IS TABLE OF rec_worksheets INDEX BY BINARY_INTEGER ;
g_worksheets tbl_worksheets ;
g_null_worksheets tbl_worksheets ;
g_worksheets_count NUMBER := 0;
TYPE rec_cell_data IS record ( r NUMBER , c NUMBER , v VARCHAR2(2000) ,s VARCHAR2(30) , w VARCHAR2(100), dt VARCHAR2(8) );
TYPE tbl_cell_data IS TABLE OF rec_cell_data INDEX BY binary_INTEGER ;
g_cells tbl_cell_data ;
g_null_cells tbl_cell_data ;
g_cell_count NUMBER := 0 ;
TYPE rec_columns_data IS record( c NUMBER, wd NUMBER, w VARCHAR2(30) ) ;
TYPE tbl_columns_data IS TABLE OF rec_columns_data Index BY BINARY_INTEGER ;
g_columns tbl_columns_data ;
g_null_columns tbl_columns_data ;
g_column_count NUMBER ;
TYPE rec_rows_data IS record( r NUMBER, ht NUMBER , w VARCHAR2(30) ) ;
TYPE tbl_rows_data IS TABLE OF rec_rows_data Index BY BINARY_INTEGER ;
g_rows tbl_ROWS_data ;
g_null_rows tbl_rows_data ;
g_ROW_count NUMBER ;
PROCEDURE p ( p_string IN VARCHAR2) is
begin
IF debug_flag = TRUE THEN
DBMS_OUTPUT.put_line( p_string) ;
END IF;
END ;
FUNCTION style_defined ( p_style IN VARCHAR2 ) RETURN BOOLEAN IS
BEGIN
FOR i IN 1..g_style_count LOOP
IF g_styles(i).s = p_style THEN
RETURN TRUE ;
END IF;
END LOOP ;
RETURN FALSE ;
END ;
-- Function : cell_used returns : BOOLEAN
-- Description : Cell_used FUNCTION returns TRUE IF that cell IS already used
-- Called BY : write_Cell_char, write_cell_num
-- ??? right now it IS NOT called BY write_Cell_null , this needs TO be evaluated
FUNCTION cell_used ( p_r IN NUMBER , p_c IN number , p_w IN VARCHAR2 ) RETURN BOOLEAN IS
BEGIN
FOR i IN 1..g_cell_count LOOP
IF ( g_cells(i).r = p_r AND g_cells(i).c = p_c AND g_cells(i).w = p_w ) THEN
RETURN TRUE ;
END IF;
END LOOP ;
RETURN FALSE ;
END ;
PROCEDURE initialize_collections IS
--- following lines resets the cell data and the cell count as it was
-- observed that the data is retained across the two runs within same seseion.
BEGIN
g_cells := g_null_cells ;
g_Cell_count := 0 ;
g_styles := g_null_styles ;
g_style_count := 0 ;
g_rows := g_null_rows ;
g_ROW_count := 0 ;
g_columns := g_null_columns ;
g_column_count := 0 ;
g_excel_data := g_null_data ;
g_data_count := 0 ;
g_apps_env := 'U';
g_worksheets := g_null_worksheets ;
g_worksheets_count := 0;
END ;
PROCEDURE create_excel_apps is
BEGIN
-- CHECK the env value
IF g_apps_env = 'N' THEN
raise_application_error( -20001 , 'You have already called create_excel ( Non Apps ) procedure, Can not set env to create_excel_apps.');
END IF ;
initialize_collections ;
g_apps_env := 'Y' ;
END ;
PROCEDURE create_excel( p_directory IN VARCHAR2 DEFAULT NULL , p_file_name IN VARCHAR2 DEFAULT NULL )
IS
BEGIN
-- CHECK the env value
IF g_apps_env = 'Y' THEN
raise_application_error( -20001 , 'You have already called procedure create_excel_apps , Can not set env to Non-Apps create_excel.');
END IF ;
initialize_collections ;
g_apps_env := 'N' ;
IF ( p_directory IS NULL OR p_file_name IS NULL ) THEN
raise_application_error( -20001 , 'p_directory and p_file_name must be not null');
END IF ;
BEGIN
-- Open the FILE IN the specified directory
l_file := utl_file.fopen( p_directory, p_file_name , 'w') ;
EXCEPTION
WHEN utl_file.write_error THEN
raise_application_error( -20101 , 'UTL_FILE raised write error, check if file is already open or directory access');
WHEN utl_file.INVALID_OPERATION THEN
raise_application_error( -20101 , 'UTL_FILE could not open file or operate on it, check if file is already open.');
WHEN utl_file.invalid_path THEN
raise_application_error( -20101 , 'UTL_FILE raised invalid path, check the directory passed is correct and you have access to it.');
WHEN others THEN
raise_application_error( -20101 , 'UTL_FILE raised others exception ');
END ;
p( 'File '||p_file_name ||' created successfully');
END ;
PROCEDURE create_style( p_style_name IN VARCHAR2
, p_fontname IN VARCHAR2 DEFAULT NULL
, p_fontcolor IN VARCHAR2 DEFAULT 'Black'
, p_fontsize IN NUMBER DEFAULT null
, p_bold IN BOOLEAN DEFAULT FALSE
, p_italic IN BOOLEAN DEFAULT FALSE
, p_underline IN VARCHAR2 DEFAULT NULL
, p_backcolor IN VARCHAR2 DEFAULT NULL ) is
l_style VARCHAR2(2000) ;
l_font VARCHAR2(1200);
BEGIN
--- CHECK IF this style IS already defined AND RAISE ERROR IF yes
IF style_defined( p_style_name ) THEN
RAISE_application_error( -20001 , 'Style "'||p_style_name ||'" is already defined.');
END IF;
g_style_count := g_style_count + 1;
---- ??? pass ANY value OF underline AND it will only use single underlines
-- ??? pattern IS NOT handleed
IF upper(p_style_name) = 'DEFAULT' THEN
RAISE_application_error( -20001 , 'Style name DEFAULT is not allowed ');
END IF ;
IF upper(p_style_name) IS NULL THEN
RAISE_application_error( -20001 , 'Style name can not be null ');
END IF ;
g_styles(g_style_count).s := p_style_name ;
g_styles(g_style_count).def := ' <Style ss:ID="'|| p_style_name ||'"> ' ;
l_font := ' <Font ' ;
IF p_fontname IS NOT NULL THEN
l_font :=l_font || 'ss:FontName="'|| p_fontname ||'" ';
end if ;
IF p_fontsize is not null then
l_font := l_font ||' ss:Size="'|| p_fontsize ||'" ';
end if ;
IF p_fontcolor is not null then
l_font := l_font ||' ss:Color="'|| p_fontcolor ||'" ';
ELSE
l_font := l_font ||' ss:Color="Black" ';
end if ;
IF p_bold = TRUE THEN
l_font := l_font ||' ss:Bold="1" ' ;
END IF;
IF p_italic = TRUE THEN
l_font := l_font ||' ss:Italic="1" ' ;
END IF;
IF p_underline IS NOT NULL THEN
l_font := l_font ||' ss:Underline="Single" ' ;
END IF ;
-- p( l_font );
g_styles(g_style_count).def := g_styles(g_style_count).def || l_font || '/>' ;
IF p_backcolor IS NOT NULL THEN
g_styles(g_style_count).def := g_styles(g_style_count).def || ' <Interior ss:Color="'||p_backcolor ||'" ss:Pattern="Solid"/>' ;
ELSE
g_styles(g_style_count).def := g_styles(g_style_count).def || ' <Interior/>';
END IF ;
g_styles(g_style_count).def := g_styles(g_style_count).def || ' </Style>' ;
--- ??? IN font there IS SOME family which IS NOT considered
END ;
PROCEDURE close_file IS
l_last_row NUMBER := 0 ;
l_dt CHAR ; -- ??? Variable TO store the datatype ; this IS NOT used at this time but may be needed IF the memory
-- issue IS there FOR example IF there IS big array
l_style VARCHAR2(140) ;
l_row_change VARCHAR2(100) ;
l_file_header VARCHAR2(2000) := '<?xml version="1.0"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:o="urn:schemas-microsoft-com:office:office"
xmlns:x="urn:schemas-microsoft-com:office:excel"
xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
xmlns:html="http://www.w3.org/TR/REC-html40">
<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
<LastAuthor>a</LastAuthor>
<Created>1996-10-14T23:33:28Z</Created>
<LastSaved>2007-05-10T04:00:57Z</LastSaved>
<Version>11.5606</Version>
</DocumentProperties>
<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
<WindowHeight>9300</WindowHeight>
<WindowWidth>15135</WindowWidth>
<WindowTopX>120</WindowTopX>
<WindowTopY>120</WindowTopY>
<AcceptLabelsInFormulas/>
<ProtectStructure>False</ProtectStructure>
<ProtectWindows>False</ProtectWindows>
</ExcelWorkbook>
<Styles>
<Style ss:ID="Default" ss:Name="Normal">
<Alignment ss:Vertical="Bottom"/>
<Borders/>
<Font/>
<Interior/>
<NumberFormat/>
<Protection/>
</Style>'
BEGIN
IF gen_xl_xml.g_Cell_count = 0 THEN
raise_application_error( -20007 , 'No cells have been written, this version of gen_xl_xml needs at least one cell to be written');
END IF;
IF gen_xl_xml.g_worksheets_count = 0 THEN
raise_application_error( -20008 , 'No worksheets have been created, this version does not support automatic worksheet creation');
END IF;
p( gen_xl_xml.g_Cell_count) ;
-- Write the header xml part IN the FILE.
g_data_count := g_data_count + 1 ;
g_excel_data( g_data_count ) := l_file_header ;
p( 'Headers written');
FOR i IN 1..g_style_count LOOP
p( ' writing style number : '||i);
g_data_count := g_data_count + 1 ;
g_excel_data( g_data_count ) := g_styles(i).def ;
END LOOP ;
-- CLOSE the styles tag
g_data_count := g_data_count + 1 ;
g_excel_data( g_data_count ) := ' </Styles>' ;
p( 'worksheet count '|| g_worksheets_count );
FOR j IN 1..g_worksheets_count LOOP
l_last_row := 0 ; --- FOR every worksheet we need TO CREATE START OF the row
p( '()()------------------------------------------------------------ last row '||l_last_row );
--- write the header first
-- write the COLUMN widhts first
-- write the cells
-- write the worksheet footer
l_row_change := NULL ;
g_data_count := g_data_count + 1 ;
g_excel_data( g_data_count ) := ' <Worksheet ss:Name="'|| g_worksheets( j).w ||'"> ' ;
p( '-------------------------------------------------------------');
p( '****************.Generated sheet '|| g_worksheets( j).w);
p( '-------------------------------------------------------------');
-- write the TABLE structure ??? change the LINE here TO include tha maxrow AND cell
g_data_count := g_data_count + 1 ;
g_excel_data( g_data_count ) := '<Table ss:ExpandedColumnCount="16" ss:ExpandedRowCount="44315" x:FullColumns="1" x:FullRows="1">' ;
FOR i IN 1..g_column_count LOOP
IF g_columns(i).w = g_worksheets( j).w THEN
g_data_count := g_data_count + 1 ;
g_excel_data( g_data_count ) := ' <Column ss:Index="'||g_columns(i).c||'" ss:AutoFitWidth="0" ss:Width="'||g_columns(i).wd ||'"/> ' ;
END IF;
END LOOP ;
-- write the cells data
FOR i IN 1..g_cell_count LOOP ------ LOOP OF g_cell_count
p( '()()()()()()()()()()()() '|| i);
--- we will write only IF the cells belongs TO the worksheet that we are writing.
IF g_cells(i).w <> g_worksheets(j).w THEN
p( '........................Cell : W :'|| g_worksheets( j).w ||'=> r='|| g_cells(i).r ||',c ='|| g_cells(i).c||',w='|| g_cells(i).w );
p( '...Not in this worksheet ');
-- l_last_row := l_last_row -1 ;
ELSE
p( '........................Cell : W :'|| g_worksheets( j).w ||'=> r='|| g_cells(i).r ||',c ='|| g_cells(i).c||',w='|| g_cells(i).w );
IF g_cells(i).s IS NOT NULL AND NOT style_defined( g_cells(i).s ) THEN
-- p(g_cells(i).s) ;
raise_application_error( -20001 , 'Style "'||g_cells(i).s ||'" is not defined, Note : Styles are case sensative and check spaces used while passing style');
END IF;
p( '()()------------------------------------------------------------ last row '||l_last_row );
IF l_last_row = 0 THEN
FOR t IN 1..g_row_count LOOP
p( '...Height check => Row =' ||g_rows(t).r ||', w='||g_rows(t).w);
IF g_rows(t).r = g_cells(i).r AND g_rows(t).w = g_worksheets(j).w THEN
p( '...Changing height') ;
l_row_change := ' ss:AutoFitHeight="0" ss:Height="'|| g_rows(t).ht||'" ' ;
g_data_count := g_data_count + 1 ;
g_excel_data( g_data_count ) := ' <Row ss:Index="'||g_cells(i).r||'"'|| l_row_change ||'>' ;
l_last_row := g_cells(i).r ;
EXIT ;
ELSE
p( '...NO change height') ;
l_row_change := NULL ;
END IF ;
END loop ;
IF l_ROW_CHANGE IS NULL THEN
g_data_count := g_data_count + 1 ;
p( '...Creating new row ');
g_excel_data( g_data_count ) := ' <Row ss:Index="'||g_cells(i).r||'"'|| l_row_change ||'>' ;
l_last_row := g_cells(i).r ;
END IF;
END IF;
IF g_cells(i).s IS NOT NULL THEN
p( '...Adding style ');
l_style := ' ss:StyleID="'||g_cells(i).s||'"' ;
ELSE
p( '...No style for this cell ');
l_style := NULL ;
END IF;
p( '()()------------------------------------------------------------ last row '||l_last_row );
IF g_cells(i).r <> l_last_row THEN
p('...closing the row.'||g_cells(i).r);
g_data_count := g_data_count + 1 ;
g_excel_data( g_data_count ) := ' </Row>' ;
p( 'ROWCOUNT : '||g_row_count );
FOR t IN 1..g_ROW_count LOOP
p( '.....Height check => Row =' ||g_rows(t).r ||', w='||g_rows(t).w);
IF g_rows(t).r = g_cells(i).r AND g_rows(t).w = g_worksheets(j).w THEN
p( '.....Changing height') ;
l_row_change := ' ss:AutoFitHeight="0" ss:Height="'|| g_rows(t).ht||'" ' ;
g_data_count := g_data_count + 1 ;
g_excel_data( g_data_count ) := ' <Row ss:Index="'||g_cells(i).r||'"'|| l_row_change ||'>' ;
EXIT ;
ELSE
p( '.....NO change height') ;
l_row_change := NULL ;
END IF ;
END loop ;
-- P( 'Row :'||g_cells(i).r ||'->'|| l_ROW_CHANGE);
IF l_row_change IS NULL THEN
g_data_count := g_data_count + 1 ;
g_excel_data( g_data_count ) := ' <Row ss:Index="'||g_cells(i).r||'"'|| l_row_change ||'>' ;
END IF;
IF g_cells(i).v IS NULL THEN
g_data_count := g_data_count + 1 ;
g_excel_data( g_data_count ) := '<Cell ss:Index="'||g_cells(i).c||'"' || l_style ||' ></Cell>';
ELSE
g_data_count := g_data_count + 1 ;
g_excel_data( g_data_count ) := '<Cell ss:Index="'||g_cells(i).c||'"' || l_style ||' ><Data ss:Type="'||g_cells(i).dt ||'">'||g_cells(i).v||'</Data></Cell>';
END IF ;
l_last_row :=g_cells(i).r ;
ELSE
IF g_cells(i).v IS NULL THEN
g_data_count := g_data_count + 1 ;
g_excel_data( g_data_count ) := '<Cell ss:Index="'||g_cells(i).c||'"' || l_style ||' > </Cell>';
ELSE
g_data_count := g_data_count + 1 ;
g_excel_data( g_data_count ) := '<Cell ss:Index="'||g_cells(i).c||'"' || l_style ||' ><Data ss:Type="'||g_cells(i).dt ||'">'||g_cells(i).v||'</Data></Cell>';
END IF ;
END IF ;
END IF ;
NULL ;
END LOOP ; -- LOOP OF g_cells_count
p('...closing the row.');
g_data_count := g_data_count + 1 ;
g_excel_data( g_data_count ) := ' </Row>' ;
-- ??? does following COMMENT will have sheet NAME FOR debugging
p( '-------------------------------------------------------------');
p( '....End of writing cell data, closing table tag');
g_data_count := g_data_count + 1 ;
g_excel_data( g_data_count ) := ' </Table>' ;
g_data_count := g_data_count + 1 ;
g_excel_data( g_data_count ) := g_worksheets(j).wftr ;
p( '..Closed the worksheet '|| g_worksheets( j).w );
END LOOP ;
g_data_count := g_data_count + 1 ;
g_excel_data( g_data_count ) := '</Workbook>' ;
p( 'Closed the workbook tag');
IF g_apps_env = 'N' THEN
FOR i IN 1..g_data_count LOOP
utl_FILE.put_line( l_file, g_excel_data(i ));
END LOOP ;
utl_file.fclose( l_file );
p( 'File closed ');
ELSIF g_apps_env = 'Y' THEN
FOR i IN 1..g_data_count LOOP
fnd_file.put_line( fnd_file.output , g_excel_data(i));
fnd_file.put_line( fnd_file.log , g_excel_data(i));
END LOOP ;
ELSE
raise_application_error( -20001 , 'Env not set, ( Apps or not Apps ) Contact Support.' );
END IF;
END ;
PROCEDURE create_worksheet ( p_worksheet_name IN VARCHAR2 ) IS
BEGIN
g_worksheets_count := g_worksheets_count + 1 ;
g_worksheets(g_worksheets_count).w := p_worksheet_name ;
g_worksheets(g_worksheets_count).whdr := '<Worksheet ss:Name=" ' || p_worksheet_name ||' ">' ;
g_worksheets(g_worksheets_count).wftr := '<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
<ProtectObjects>False</ProtectObjects>
<ProtectScenarios>False</ProtectScenarios>
</WorksheetOptions>
</Worksheet>' ;
END ;
PROCEDURE write_cell_char(p_row NUMBER, p_column NUMBER, p_worksheet_name IN VARCHAR2, p_value IN VARCHAR2, p_style IN VARCHAR2 DEFAULT NULL ) IS
l_ws_exist BOOLEAN ;
l_worksheet VARCHAR2(2000) ;
BEGIN
-- CHECK IF this cell has been used previously.
IF cell_used( p_row , p_column , p_worksheet_name ) THEN
RAISE_application_error( -20001 , 'The cell ( Row: '||p_row ||' Column:'||p_column ||' Worksheet:'||p_worksheet_name ||') is already used.Check if you have missed to increment row number in your code. ');
END IF;
-- IF worksheet NAME IS NOT passed THEN use first USER created sheet ELSE use DEFAULT sheet
-- this PROCEDURE just adds the data INTO the g_cells TABLE
g_cell_count := g_cell_count + 1 ;
g_cells( g_cell_count ).r := p_row ;
g_cells( g_cell_count ).c := p_column ;
g_cells( g_cell_count ).v := p_value ;
g_cells( g_cell_count ).w := p_worksheet_name ;
g_cells( g_cell_count ).s := p_style ;
g_cells( g_cell_count ).dt := 'String' ;
END ;
PROCEDURE write_cell_num(p_row NUMBER , p_column NUMBER, p_worksheet_name IN VARCHAR2, p_value IN NUMBER , p_style IN VARCHAR2 DEFAULT NULL ) IS
l_ws_exist BOOLEAN ;
l_worksheet VARCHAR2(2000) ;
BEGIN
-- ??? IF worksheet NAME IS NOT passed THEN use first USER created sheet ELSE use DEFAULT sheet
-- this PROCEDURE just adds the data INTO the g_cells TABLE
-- CHECK IF this cell has been used previously.
IF cell_used( p_row , p_column , p_worksheet_name ) THEN
RAISE_application_error( -20001 , 'The cell ( Row: '||p_row ||' Column:'||p_column ||' Worksheet:'||p_worksheet_name ||') is already used. Check if you have missed to increment row number in your code.');
END IF;
g_cell_count := g_cell_count + 1 ;
g_cells( g_cell_count ).r := p_row ;
g_cells( g_cell_count ).c := p_column ;
g_cells( g_cell_count ).v := p_value ;
g_cells( g_cell_count ).w := p_worksheet_name ;
g_cells( g_cell_count ).s := p_style ;
g_cells( g_cell_count ).dt := 'Number' ;
END ;
PROCEDURE write_cell_null(p_row NUMBER , p_column NUMBER , p_worksheet_name IN VARCHAR2, p_style IN VARCHAR2 ) IS
BEGIN
-- ???? NULL IS allowed here FOR time being. one OPTION IS TO warn USER that NULL IS passed but otherwise
-- the excel generates without error
g_cell_count := g_cell_count + 1 ;
g_cells( g_cell_count ).r := p_row ;
g_cells( g_cell_count ).c := p_column ;
g_cells( g_cell_count ).v := null ;
g_cells( g_cell_count ).w := p_worksheet_name ;
g_cells( g_cell_count ).s := p_style ;
g_cells( g_cell_count ).dt := NULL ;
END ;
PROCEDURE set_row_height( p_row IN NUMBER , p_height IN NUMBER, p_worksheet IN VARCHAR2 ) IS
BEGIN
g_ROW_count := g_ROW_count + 1 ;
g_rows( g_row_count ).r := p_row ;
g_rows( g_row_count ).ht := p_height ;
g_rows( g_row_count ).w := p_worksheet ;
END ;
PROCEDURE set_column_width( p_column IN NUMBER , p_width IN NUMBER, p_worksheet IN VARCHAR2 ) IS
BEGIN
g_column_count := g_column_count + 1 ;
g_columns( g_column_count ).c := p_column ;
g_columns( g_column_count ).wd := p_width ;
g_columns( g_column_count ).w := p_worksheet ;
END ;
END ;
SHOW errors ;
Thanks,
Maddy BHi,
Peter Gjelstrup wrote:
Next thing is how to use it:
declare
k_file constant varchar2(30) := 'YourFile.xls'
begin
create_file(k_file);
-- Call other procedures
close_file;
end;
Don't forget: these procedures are all part of the gen_xl_xml package.
To call them from outside the package, you have to prefix each procedure name with the package name, like this:
declare
k_file constant varchar2(30) := 'YourFile.xls'
begin
gen_xl_xml.create_file(k_file);
-- Call other procedures
gen_xl_xml.close_file;
end; -
How to generate .xsd file using jaxb generated java files
Hi,
We need to upgrade our applicatio to jdk1.6 which has jaxb2.0 class files in it. Our application has java files generated from .xsd using jaxb1.0.2 version. At present we dont have .xsd or .xml file with us.
We decide to generate .xsd file by using jaxb1.0.2 generated java files. I tried using schemagen.exe given by jdk1.6 to generate .xsd file. It error out. Is there any other way to generate .xsd file ?
pls let me know.
thanks,
ThiruObject-XML mapping is a new feature in JAXB 2.0. Classes generated with JAXB 1.0 won't generate a schema.
Generate Java classes with JAXB 2.0 xjc.
http://www.theregister.co.uk/2006/09/22/jaxb2_guide/ -
Dynamically generating flat file using OWB10gr2
Hi,
I am trying to generated an XML file using OWB10gR2.
It is achievable to create a predefined file ie with static name or add sysdate into the file name,but can we name the file depending on the Request Id which can be provided as an Input to the mapping.
Any suggestions will be helpful.
Regards,
PHD.You can define expressions which you might be able to be creative with;
http://blogs.oracle.com/warehousebuilder/2007/07/dynamically_generating_target.html
Cheers
David -
Performance problems to generate PDF files using CR
Hi,
I develop an application that read TXT files and uses this information to generate PDF files, but I'm having problems with performance to generate this PDF, each files are taking at least 1 minute to create the file. I realized that some TMP and RPT files are generated and deleted in the temp folder of the machine which is running the application, but after some time creating the PDF's the RPT files aren't deleted and I have an exception on my app:
Memory full.
Failed to export the report.
Not enough memory for operation. at CrystalDecisions.ReportAppServer.Controllers.ReportSourceClass.Export(ExportOptions pExportOptions, RequestContext pRequestContext)
at CrystalDecisions.ReportSource.EromReportSourceBase.ExportToStream(ExportRequestContext reqContext)
at CrystalDecisions.CrystalReports.Engine.FormatEngine.ExportToStream(ExportRequestContext reqContext)
at CrystalDecisions.CrystalReports.Engine.FormatEngine.Export(ExportRequestContext reqContext)
at CrystalDecisions.CrystalReports.Engine.ReportDocument.ExportToDisk(ExportFormatType formatType, String fileName)
The server who is running this application is a Dual Core AMD Opteron 2.61 ghz, 7 GB RAM
The framework version is 2.0 and the Crystal Reports dll version is 10.5.3700.0
Thanks.Hi,
If you are using IIS5 the give aspnet full permission to the Temp folders. For IIS6 give IIS_wpg permission.
For this you need to right click on the folder,
go to properties,
security tab,
click on Add,
Type aspnet/iis_wpg,
select top note in Location and click on check on check names.
Give full control and
click ok.
Also try using GC.Collect(), reportDocObject.Close() and reportDocObject.Dispose() as clean up code.
Regards,
AG. -
Getting generated class files using the compiler api??
I am writing a compiler/IDE for java, and i use the new JavaCompiler API
(javax.tools.JavaCompiler)
i want to ask, is it possible to get the generated class file(compiled file) names??
can anyone help me with this, read at the documentation and i have no idea which one is used to do such thing..
Or is it impossible??
Thanks, please guide me on this..E.D.-inc wrote:
I am writing a compiler/IDE for java, and i use the new JavaCompiler API
don't.
i want to ask, is it possible to get the generated class file(compiled file) names??
yes, probably (after all, other tools can do it). Don't ask me how though, I've never had a need to.
can anyone help me with this, read at the documentation and i have no idea which one is used to do such thing..
no. Someone else reading the documentation for you won't help you any. Read it yourself, you might learn something.
Maybe you are looking for
-
Hello, I ran a new install of Team Foundation Server and let it install the built in SharePoint pieces on a single server setup. After the install i'm able to access the http://teamfoundation:8080/tfs/ address without issue but am unable to create a
-
I'm kind of stumped and this has been a question of mine for some time. I did some further digging on it, and did find that what it's reading is the Photoshop Color Mode XMP data, which is odd since the files were never in Photoshop, and were created
-
Layout Template - Alignment Problem
Hi, I´m using EP6 Version 6.0.2.4.6 and made some Layout-Templates for my Pages. It works fine, but the alignment of the Ivies in it doesn´t match. A short Example: <%@ taglib uri="prt:taglib:com.sap.portal.reserved.layout.TagLibHtmlb" prefix="hbj" %
-
Can any one help me in setting an all day event. Am using wcap to create an all day event. if i set the start date as 20070824T020000Z and isAllDay to 1.The event get scheduled on 23 of aug.Do i need to pass any other parameter along with isAllDay pa
-
Audio filesge to their computer. One cannot apparently do that with audio f
Greetings and happy new year! I am a musical hobbyist and want to post my music on my website in such a way that people can download them. When u add a graphic people can do a cntrl-click and select to save the ima