Focal Point
[CLOSED] Excel / PDF / CSV issue in column header

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/6547092196

May 09, 2019, 07:06 AM
Madhumitha
[CLOSED] Excel / PDF / CSV issue in column header
Hi,

I am generate four types of report output - AHTML / PDF / EXCEL / CSV, based on user selection. Please find the below code.

-SET &TITLE_MSG =
- 'Country';

TABLE FILE CAR
SUM
SALES AS 'Sales'
BY COUNTRY AS '&TITLE_MSG'
ON TABLE PCHOLD FORMAT &WFHTML
END

My issue is ASName is working fine for AHTML report but when I export to pdf or csv or excel the column name display entire span details.

Is there any possibility to off span when we export to pdf or csv formats?

Is there any solution, please let me know

Thanks,
Madhu
8204

This message has been edited. Last edited by: FP Mod Chuck,
May 09, 2019, 07:37 AM
MartinY
Hi,

Can't see your issue. It works great either in my 8.2.0.1M gen 240 or 8.2.04 gen 48.


Could it be possible that you have styling applied behind the scene from a profile ?

Add SET &ECHO = ALL at the top of your fex and look the executed code (view source)

Please use the code tag when posting sample code or sample output.
It's the last icon on the ribbon :
</>



WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
May 09, 2019, 11:59 AM
Madhumitha
Please find the below code

 
TABLE FILE CAR
SUM
SALES AS '<div title="Sales Quota=50K">Sales</div>'
SALES AS '<span title="Sales Quota=50K">SPANSales</span>'
BY COUNTRY
ON TABLE SET PAGE-NUM OFF
ON TABLE SET WEBVIEWTARG OFF
ON TABLE SET WEBVIEWER ON
ON TABLE PCHOLD FORMAT AHTML
ON TABLE SET STYLE *
END


Export to excel or pdf or csv, will get the span details in the column header

  
TABLE FILE CAR
SUM
SALES AS '<div title="Sales Quota=50K">Sales</div>'
SALES AS '<span title="Sales Quota=50K">SPANSales</span>'
BY COUNTRY
ON TABLE SET PAGE-NUM OFF
-*ON TABLE SET WEBVIEWTARG OFF
-*ON TABLE SET WEBVIEWER ON
ON TABLE SET PAGE-NUM OFF
ON TABLE SET ASNAMES ON
ON TABLE NOTOTAL
ON TABLE PCHOLD FORMAT COMT
ON TABLE SET HTMLEMBEDIMG ON
ON TABLE SET STYLE *
$
ENDSTYLE
END

This message has been edited. Last edited by: Madhumitha,
May 09, 2019, 12:24 PM
Hallway
That is because you are exporting the table from the AHTML page. The AHTML page renders the HTML markup within the table so that you don't see the code. However, Excel, pdf, csv do not have an html engine to render the code.

What is the reason for using html markup in the as name?


Hallway

 
Prod: 8202M1
Test: 8202M4
Repository:
 
OS:
 
Outputs:
 
 
 
 
May 09, 2019, 12:37 PM
Hallway
If you are looking to have the end user select a report output from a prompt, you could do something like this:
 
-SET &WFFMT = &WFFMT.(<WebPage,HTML>,<Active,AHTML>,<Pdf,PDF>,<Excel,XLSX>,<CSV,COMT>).Select the report output.;

-SET &WEB = IF &WFFMT CONTAINS 'HTML' THEN '' ELSE 'FOC_NONE';
-SET &FIL = IF &WFFMT CONTAINS 'HTML' THEN 'FOC_NONE' ELSE '';

TABLE FILE CAR
SUM
&WEB SALES AS '<div title="Sales Quota=50K">Sales</div>'
&WEB SALES AS '<span title="Sales Quota=50K">SPANSales</span>'
&FIL SALES AS 'Sales'
&FIL SALES AS 'SPANSales'
BY COUNTRY
ON TABLE SET PAGE-NUM OFF
&FIL ON TABLE SET WEBVIEWTARG OFF
&FIL ON TABLE SET WEBVIEWER ON
ON TABLE PCHOLD FORMAT &WFFMT
ON TABLE SET STYLE *
END 



Hallway

 
Prod: 8202M1
Test: 8202M4
Repository:
 
OS:
 
Outputs:
 
 
 
 
May 09, 2019, 12:49 PM
Madhumitha
Instead of commenting based on report output is there any other way? I have more than 300 columns in the report. if I follow the above method then 600 lines have to write.

Is there any other way? please let me know
May 09, 2019, 05:06 PM
Waz
I don't think you are going to get away with a simple fix.

I would suggest -SET a variable for each title, slightly less coding.

-SET &Col1 = IF &Fmt EQ 'AHTML' OR 'HTML' THEN '<div title="Sales Quota=50K">Sales</div>' ELSE 'Sales' ;
.
.
.
TABLE FILE CAR
SUM
SALES AS &Col1
.
.
.



Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

May 13, 2019, 01:33 AM
Madhumitha
Hi,

if i used set variables then for each column have to use one set variable. so, if i used more than 600 variables then what is the impact, please let me know

Thanks,
Madhu
May 13, 2019, 04:58 PM
Waz
Hi Madhu,

Shouldn't have any impact, if its just creating amper vars and using them.


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

May 13, 2019, 05:16 PM
Doug
Going back to the original post: How do this modified code work for you?
TABLE FILE CAR
SUM
SALES AS 'Sales'
BY COUNTRY AS '&TITLE_MSG.EVAL'
ON TABLE PCHOLD FORMAT &WFHTML.EVAL
ON TABLE SET ASNAMES ON
ON TABLE SET HOLDLIST PRINTONLY
END
Just thinking out loud...