Question
Rochdi Badis · Oct 13, 2022

Export to Excel with GenerateReport()

Hi Guys,

I'm exporting a Zen report to excel using the following : SET Status=rpt1.GenerateReport("c:\temp\Intruments.xls",10)

and it's working ok but I'm getting extra fields that they shouldn't be there.

here is the correct html format :

 

and this is what I'm getting in excel with extra first 4 columns

and I'm guessing that those extras are coming from these attributes and elements, so how can I exclude those extra fields?  

 

 

 

Thanks 

Product version: Caché 2014.1
0
0 123
Discussion (4)2
Log in or sign up to continue

Hello,

Yes, excel does not look at your ReportDisplay xdata at all - it only looks at your ReportDefinition xdata. Any item defined in there is included within the excel output. The only way to control whether entries appear in your ReportDefinition based on mode would be to change to a call method so that you could have the flexibility to control what is in the stream.

Thanks Julie

Not sure what you mean by call method or how to do that?

Thanks

If those fields are not used in the ReportDisplay, ie the HTML or PDF output, you could consider removing them from the ReportDefinition.  If on the other hand, you do need these fields then leave them in.  However, something else seems to be going on.  I commonly have this style of ReportDefinition

The usage of <macrodef > just allows me to have a single set of code that injects the same attributes into the <Master> node.

When running the report in XML mode it produces

<Master runDt="10/13/2022" footerDate="October 13, 2022" runTm="08:47AM" runBy="_SYSTEM" Draft="" ISCPrime="0" Instance="HEALTHSHARE" Namespace="HSEDGE1" Server="LAPTOP-ET8APOSR" InternalURLLinkPrefix="http://localhost:52773" CustomerName="Ready Computing, Inc" CoverPageDate="October 13, 2022" CustomerLink="" PageNumbering="1" SystemMode="" FilterSpecDisplay="" ReportName="Ensemble Message Management" HeaderLine2="" Top="9999999999999" ReportClass="RC.Ens.Report.MessageManagement" ZVERSION="IRIS for Windows (x86-64) 2021.1.2 (Build 336_0_21564U) Tue Apr 12 2022 12:13:45 EDT" ReportTitle="">

I don't think attributes found in the root node, in my case Master, are emitted to the Excel file.

If I run the report in MODE=XLSX mode it produces.. note it does not show the attributes 

so this is answering your question regarding your attributes at the top level.  Your question regarding the elements at the ProssData node is something different.  In my example, if I change 

to 

and then run the report in XLSX mode the attributes Namespace and TaskId do not appear in the Excel file.  However, I would have to change the ReportDisplay so that I now reference

@Namespace and @TaskId

if I want the PDF and HTML output to work properly.