# Converting to Excel

**URL:** <https://techcommunity.softwareag.com/t/converting-to-excel/75541>\
**Category:** Forum\
**Tags:** Mainframe-Integration, ApplinX\
**Created:** [October 19, 2007, 6:03pm UTC](https://techcommunity.softwareag.com/t/converting-to-excel/75541 "2007-10-19T18:03:06Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![JoeA](https://avatars.discourse-cdn.com/v4/letter/j/b38774/32.png) [@JoeA](https://techcommunity.softwareag.com/u/JoeA)\
**Post date:** [October 19, 2007, 6:03pm UTC](https://techcommunity.softwareag.com/t/converting-to-excel/75541/1 "2007-10-19T18:03:06Z")

</div>

When I send a Collection Table to Excel from a link on my jsp and open it in Excel, when I go back to my jsp, no matter what link I press, it seems to refresh my screen only. If I then press the same link again, it works fine. I have attached a sample jsp and the java file for it. I have also attached the excel jsp page. I will try to add the excel java file also, but 3 seems to be the limit.

Joe Ayres  
Curtis Circulation Co.  
[PA2.java](https://techcommunity.softwareag.com/uploads/short-url/8GwZTfmBmtaJ6NmO1iiZNz46xSD.java) (6.1 KB)  
[PA2\_excel.jsp](https://techcommunity.softwareag.com/uploads/short-url/4tlRWcb3NNrZpIJmU60BomMFw0Z.jsp) (6.63 KB)  
[PA2.jsp](https://techcommunity.softwareag.com/uploads/short-url/8CZ7snUfH8iIfSxYTpUNGkXGnWL.jsp) (14.1 KB)

---

<div class="post-metadata">

**Author:** ![JoeA](https://avatars.discourse-cdn.com/v4/letter/j/b38774/32.png) [@JoeA](https://techcommunity.softwareag.com/u/JoeA)\
**Post date:** [October 19, 2007, 6:05pm UTC](https://techcommunity.softwareag.com/t/converting-to-excel/75541/2 "2007-10-19T18:05:39Z")

</div>

Here is the excel java file.  
[PA2\_excel.java](https://techcommunity.softwareag.com/uploads/short-url/rydfxOvls8hfNMyUHwOHZcZPWlx.java) (5.24 KB)

---

<div class="post-metadata">

**Author:** ![Yana\_Zhivin](https://avatars.discourse-cdn.com/v4/letter/y/439d5e/32.png) [@Yana\_Zhivin](https://techcommunity.softwareag.com/u/Yana_Zhivin)\
**Post date:** [October 22, 2007, 8:53pm UTC](https://techcommunity.softwareag.com/t/converting-to-excel/75541/3 "2007-10-22T20:53:39Z")

</div>

Hi Joe!  
I tried to reproduce on our applications that contain similar scenarios, but was unable to find anything resembling your case.

So, to reproduce exactly, I need a GXZ of your application and a GCT containing the pages that show the table you are collecting.

Thank you,  
Yana.

---

<div class="post-metadata">

**Author:** ![JoeA](https://avatars.discourse-cdn.com/v4/letter/j/b38774/32.png) [@JoeA](https://techcommunity.softwareag.com/u/JoeA)\
**Post date:** [October 22, 2007, 11:02pm UTC](https://techcommunity.softwareag.com/t/converting-to-excel/75541/4 "2007-10-22T23:02:04Z")

</div>

Hi Yana,  
Thanks for your reply. I have attached the files you requested. When I got to the point of creating my excel file, I had it open, it looked good, I then closed excel and went back to my jsp page. I then clicked the link for the Menu and the screen blinked. (probably refreshed?) I then pressed the same link again and went to the Menu screen. This is the action I was referring to.

Thanks,

Joe

---

<div class="post-metadata">

**Author:** ![JoeA](https://avatars.discourse-cdn.com/v4/letter/j/b38774/32.png) [@JoeA](https://techcommunity.softwareag.com/u/JoeA)\
**Post date:** [October 22, 2007, 11:06pm UTC](https://techcommunity.softwareag.com/t/converting-to-excel/75541/5 "2007-10-22T23:06:46Z")

</div>

Well, that didn’t fare very well. I zipped the files and here we go again.

Joe  
[SAG.zip](https://techcommunity.softwareag.com/uploads/short-url/1I12dy5LASsBIRrE53RguwPA9ZI.zip) (239 KB)

---

<div class="post-metadata">

**Author:** ![Asaf\_Shak](https://avatars.discourse-cdn.com/v4/letter/a/cdc98d/32.png) [@Asaf\_Shak](https://techcommunity.softwareag.com/u/Asaf_Shak)\
**Post date:** [October 25, 2007, 3:10pm UTC](https://techcommunity.softwareag.com/t/converting-to-excel/75541/6 "2007-10-25T15:10:32Z")

</div>

Hi Joe,  
The problem is probably with the bold definition.  
There is no HTML definition \<

---

<div class="post-metadata">

**Author:** ![JoeA](https://avatars.discourse-cdn.com/v4/letter/j/b38774/32.png) [@JoeA](https://techcommunity.softwareag.com/u/JoeA)\
**Post date:** [October 29, 2007, 6:21pm UTC](https://techcommunity.softwareag.com/t/converting-to-excel/75541/7 "2007-10-29T18:21:58Z")

</div>

Asaf, thanks for the reply. As far as I can tell, where I utilize the “bold” parameter seems correct. I have it coded as "style=“font-weight:bold;” in the jsp excel pages, and “font-weight:bold;” within a tab in the regular jsp pages. What I believe, is that there seems to be some lack of syncronization with Applinx and the Host screen. One point to consider is I have recently found that a jsp page that contains a vertical collection table will function correctly in pressing link buttons. The problem seems to lie with my horizontal and vertical collection tables. I may have 2 or 3 horizontal screens combined into a collection table which can result in a significantly large jsp screen that could have hundreds of rows of data displayed. When I activate the “excel” link, the excel.jsp page is called and the function executed, but I think it is getting confused somewhere (I know I am), and it is still residing on the excel.jsp page with the Host screen being elsewhere. Now, would Applinx then execute some sort of syncronization to align itself with the Host screen? Maybe this is the “blink” that occurs. I appreciate your assistance and welcome any suggestions.

---

<div class="post-metadata">

**Author:** ![Asaf\_Shak](https://avatars.discourse-cdn.com/v4/letter/a/cdc98d/32.png) [@Asaf\_Shak](https://techcommunity.softwareag.com/u/Asaf_Shak)\
**Post date:** [October 29, 2007, 9:38pm UTC](https://techcommunity.softwareag.com/t/converting-to-excel/75541/8 "2007-10-29T21:38:32Z")

</div>

Hi Joe,  
We recommend you to save the collected table in session variable, and the excel page should read the table from the session variable.  
There is such an example in the attached ZIP file. In WareHouseList.java you can see how it  
[WarehousesList.zip](https://techcommunity.softwareag.com/uploads/short-url/64PDstCq7CmcNjg65femw7bwOne.zip) (2.16 KB)

---

<div class="post-metadata">

**Author:** ![JoeA](https://avatars.discourse-cdn.com/v4/letter/j/b38774/32.png) [@JoeA](https://techcommunity.softwareag.com/u/JoeA)\
**Post date:** [November 2, 2007, 12:44am UTC](https://techcommunity.softwareag.com/t/converting-to-excel/75541/9 "2007-11-02T00:44:45Z")

</div>

Asaf,

In my previous examples, I believe it already does this. In the PA2.java file I have:

public void gx\_fillForm() throws GXGeneralException{

```
 //This will run the path to gather the single occurrance fields for the jsp page.
	GXPathResponse res = getGXSession().executePath("Potential_analysis_collection");
	gx_fillForm(res.getScreens());

 //This runs the path to create the Applinx table for the jsp page.
    GXITable gx_table = getGXSession().getTable("Potential_analysis_collection");
    getTagsAccesor().setTagTable("Potential_analysis_collection",gx_table,getGXAppConfig().getTableBuildConfig(),this);
	getSession().setAttribute(EXCEL_TABLE_SESSION_KEY, gx_table);

```

}

The PA2\_excel.java file has this:

```
              /// Retrieving A table stored in the http session
                Object obj = getSession().getAttribute(EXCEL_TABLE_SESSION_KEY);
                if (obj != null){
                	gx_table = (GXITable)obj;
                  }
                  else{
                      gx_table = getGXSession().getTable();
                  }

                getResponse().reset();
				getResponse().setContentType("application/vnd.ms-excel");
				getResponse().addHeader("Content-Disposition","attachment; filename=\"" + gx_table.getName() + ".xls\"");

               GXTableSerializer serializer = new GXTableSerializer();

               String xlStr = serializer.serialize(gx_table, getApplication().getRealPath("/hostTable.xsl"));
                getTagsAccesor().setTagContent("excelData", xlStr);

```

Isn’t this doing what your example shows? Please correct me if I am wrong.

Thanks,

Joe

---

<div class="post-metadata">

**Author:** ![Asaf\_Shak](https://avatars.discourse-cdn.com/v4/letter/a/cdc98d/32.png) [@Asaf\_Shak](https://techcommunity.softwareag.com/u/Asaf_Shak)\
**Post date:** [November 4, 2007, 7:25pm UTC](https://techcommunity.softwareag.com/t/converting-to-excel/75541/10 "2007-11-04T19:25:12Z")

</div>

Hi Joe,  
We think that we know where the synchronization problem with the host is. In PA2\_excel.java, in the else clause you call [i]

---

<div class="post-metadata">

**Author:** ![JoeA](https://avatars.discourse-cdn.com/v4/letter/j/b38774/32.png) [@JoeA](https://techcommunity.softwareag.com/u/JoeA)\
**Post date:** [November 6, 2007, 1:18am UTC](https://techcommunity.softwareag.com/t/converting-to-excel/75541/11 "2007-11-06T01:18:57Z")

</div>

Hello Asaf,

I placed the Collection table name where you suggested,  
[PA2.zip](https://techcommunity.softwareag.com/uploads/short-url/ilUYrfDsE5NZjUxYGA2ZXsj4Kab.zip) (131 KB)

---

<div class="post-metadata">

**Author:** ![Asaf\_Shak](https://avatars.discourse-cdn.com/v4/letter/a/cdc98d/32.png) [@Asaf\_Shak](https://techcommunity.softwareag.com/u/Asaf_Shak)\
**Post date:** [November 7, 2007, 1:37pm UTC](https://techcommunity.softwareag.com/t/converting-to-excel/75541/12 "2007-11-07T13:37:06Z")

</div>

Hi Joe,  
We saw what the problematic issues are.  
We wrote a code sample that solves the problem. Before we hand it to you, we want to debug it and see that it fits your case,  
So we will need a new GCT, that doesn

---

<div class="post-metadata">

**Author:** ![JoeA](https://avatars.discourse-cdn.com/v4/letter/j/b38774/32.png) [@JoeA](https://techcommunity.softwareag.com/u/JoeA)\
**Post date:** [November 7, 2007, 7:02pm UTC](https://techcommunity.softwareag.com/t/converting-to-excel/75541/13 "2007-11-07T19:02:49Z")

</div>

Hello Asaf,

I believe that I have created the GCT that you wanted. Please let me know if it isn’t what you were looking for.

Thanks,  
Joe  
[PA2\_Manual.zip](https://techcommunity.softwareag.com/uploads/short-url/5TKhzA00HQLaVIJP55fvzx9VeTQ.zip) (54.9 KB)

---

<div class="post-metadata">

**Author:** ![Asaf\_Shak](https://avatars.discourse-cdn.com/v4/letter/a/cdc98d/32.png) [@Asaf\_Shak](https://techcommunity.softwareag.com/u/Asaf_Shak)\
**Post date:** [November 8, 2007, 6:06pm UTC](https://techcommunity.softwareag.com/t/converting-to-excel/75541/14 "2007-11-08T18:06:39Z")

</div>

Hi Joe,  
Thanks for the GCT, it was indeed what we were looking for.  
We contract a code example that should solve the problems you are facing.  
In your code instead of calling

---

<div class="post-metadata">

**Author:** ![JoeA](https://avatars.discourse-cdn.com/v4/letter/j/b38774/32.png) [@JoeA](https://techcommunity.softwareag.com/u/JoeA)\
**Post date:** [November 12, 2007, 7:39pm UTC](https://techcommunity.softwareag.com/t/converting-to-excel/75541/15 "2007-11-12T19:39:50Z")

</div>

Hi Asaf,

This worked fine for helping me to run the path only once. Thanks for all of your assistance.

Joe

---

<div class="post-metadata">

**Author:** ![Asaf\_Shak](https://avatars.discourse-cdn.com/v4/letter/a/cdc98d/32.png) [@Asaf\_Shak](https://techcommunity.softwareag.com/u/Asaf_Shak)\
**Post date:** [November 12, 2007, 7:41pm UTC](https://techcommunity.softwareag.com/t/converting-to-excel/75541/16 "2007-11-12T19:41:53Z")

</div>

Great.  
Glad that we could help you.  
Asaf and Aplinx team

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [April 2, 2021, 2:48pm UTC](https://techcommunity.softwareag.com/t/converting-to-excel/75541/17 "2021-04-02T14:48:50Z")

</div>

Closed on April 2, 2021, 2:48pm UTC


