Discussion

ExportToExcel

I am building a custom activity that calls ExportToExcel. The idea is to build out an HTML table in a string then pass that to ExportToExcel for it to output an excel. However this is not working. Would anyone be able to advise me as to the correct format of the table or if I am missing any steps that are required?

 

PS. In an attempt to figure out if there is a specific format that ExportToExcel is looking for, I have looked into the Java code and noticed there is a "sendData()" function but have not been able to find any references anywhere to that function in the documentation. I am using version 6.1 SP2.

**Moderation Team has archived post**

This post has been archived for educational purposes. Contents and links will no longer be updated. If you have the same/similar question, please write a new post.

Comments

Keep up to date on this post and subscribe to comments

September 10, 2013 - 10:31am

What are you sending? <HTML><BODY><TABLE>...</TABLE></BODY></HTML> should work.

What is not working? What do you see in Fiddler?

sendData() is a v02 API -- this was phased out 10 years ago (!) with Pega v3.2, but the code hasn't all been replaced.The replacement code is:

tools.getThread().getThreadPage().putString("pxHTMLStream", stream);

Jon

September 10, 2013 - 4:18pm

To summarize My activity looks like this...

Step1 local.Source="<html><body><table><tr><td>&nbsp;</td></tr></table></body></html>"

Step2 Call ExportToExcel pass in pyFileData = local.Source

 

When run the activity says would you like to Open or Save. If I open it does nothing. If I save it says "Unable to download.

 

Unable to open this Internet site. The requested site is either unavailable or cannot be found. Please try again later"

September 10, 2013 - 4:28pm

Have you traced in Fiddler to see what's coming over the HTTP?

September 11, 2013 - 10:27am

I do not believe that Fiddler is on the list of approved software I can have on my machine unfortunately.

September 11, 2013 - 12:04pm

Ah silly of me to mention it, and silly of Mastercard to prohibit it. IE9 includes a Developer Tools which allow you to trace the HTTP network traffic.

 

September 11, 2013 - 4:10pm

I was able to get the below table to work.. But if I remove any of the rows from the bottom it breaks. There were 5 cells in the nested table I couldn't remove them but for some reason it allows me to take them out if I use colspan="1"... I would love to know more about this process and the format it is requiring so that I could better use it.

 

 

"<table cellspacing='0' cellpadding='0' style='border:1px solid black'>
 <tr>
  <td align='center' style='color:white; font-weight:bold; background-color:DarkGray'>
   <table cellspacing='0' cellpadding='0'>
    <tr>
     <td colspan='1' style='border: 1px solid Gray;'>Info</td>
    </tr>  
   </table>
  </td>
 </tr>
 <tr>
  <td style='horizontal-align:left; background-color:WhiteSmoke'>12341</td>
 </tr>
 <tr>
  <td style='background-color:LightGrey'>12342</td>
 </tr>
 <tr>
  <td style='background-color:WhiteSmoke'>12343</td>
 </tr>
 <tr>
  <td style='background-color:LightGrey'>12345</td>
 </tr>
 <tr>
  <td style='background-color:WhiteSmoke'>12346</td>
 </tr>
 <tr>
  <td style='background-color:LightGrey'>12347</td>
 </tr>
 <tr>
  <td style='background-color:WhiteSmoke'>12348</td>
 </tr>

 <tr>
  <td style='background-color:LightGrey'>31211</td>
 </tr>
 <tr>
  <td style='background-color:WhiteSmoke'>31212</td>
 </tr>

 <tr>
  <td style='background-color:LightGrey'>41213</td>
 </tr>
 <tr>
  <td style='background-color:WhiteSmoke'>21516</td>
 </tr>

</table>"

November 30, 2013 - 5:58am

Hi,

Even the below XML structure can be used.

<?xml version="1.0"?>

<ss:Workbook xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet">

    <ss:Styles>

        <ss:Style ss:ID="1">

            <ss:Font ss:Bold="1"/>

        </ss:Style>

    </ss:Styles>

    <ss:Worksheet ss:Name="Sheet1">

        <ss:Table>

            <ss:Column ss:Width="80"/>     

            <ss:Row ss:StyleID="1">

                <ss:Cell>

                   <ss:Data ss:Type="String">Name</ss:Data>

                </ss:Cell>

            </ss:Row>

            <ss:Row>

                <ss:Cell>

                   <ss:Data ss:Type="String">....</ss:Data>

                </ss:Cell>  

            </ss:Row>

            ...

            </ss:Row>

        </ss:Table>

    </ss:Worksheet>

</ss:Workbook>

where the </ss:Worksheet> refers to the tab in the excel.

December 4, 2013 - 12:53pm

Indeed, that's the OpenOffice XML standard, which Excel began supporting in 2007.

March 29, 2016 - 11:09am

Hi.... Before calling ExportToExcel , call activty pzCreateExportdata  with  step page as pyReportContentPage.pyReportDefinition  and  stream created by this activty and stored in parameter pyViewData. Now this pyViewData passed as paarmeter to ExportToExcel activity. It will produce excel sheet with stream data.