Using Xml To Create Excel File

PrJlndni

Member
Hello Everyone.

Good day!

I have tried the uploaded source codes that will create excel file thru xml here PEG Utilities Page.

But then I have the following questions:
1. Can I insert titles? or other headers to the excel file?
e.g.
Accounting Department
Username and Date
Column headers

2. May I ask how it can be done?

Thank you very much everyone for your help.
It's really appreciated.

Sincerely yours,

Pr
 
This is the sample code I used.
Code:
DEF TEMP-TABLE foo
      FIELD t_ItemNo      LIKE FAIS.Inventory.InvCode             COLUMN-LABEL "ITEM NO."
    FIELD t_InvID       LIKE FAIS.Inventory.InvID               COLUMN-LABEL "INVID"
    FIELD t_Desc        LIKE FAIS.Inventory.InventoryDesc       COLUMN-LABEL "DESCRIPTION"
    FIELD t_SubItemC    LIKE FAIS.Inventory.SubInvCode          COLUMN-LABEL "SUB ITEM CODE".
  
DEF VAR pHand AS HANDLE.
DEF VAR thand AS HANDLE.
DEF VAR i AS INT.
DEF VAR hXdoc AS HANDLE.

FOR EACH FAIS.Inventory NO-LOCK WHERE FAIS.Inventory.InvCode BEGINS "0221" BY FAIS.Inventory.InvCode.
    CREATE foo.
    ASSIGN t_ItemNo = FAIS.Inventory.InvCode
           t_InvID  = FAIS.Inventory.InvID
           t_Desc   = FAIS.Inventory.InventoryDesc
           t_SubItemC = FAIS.Inventory.SubInvCode.
END.
thand = TEMP-TABLE foo:HANDLE.

CREATE X-DOCUMENT hXdoc.
RUN xmlspreadsheet.p PERSISTENT SET pHand.

RUN setColumnWidth IN pHand ("t_ItemNo",150).
RUN setColumnWidth IN pHand ("t_InvID",60).
RUN setColumnWidth IN pHand ("t_Desc",150).
RUN setColumnWidth IN pHand ("t_SubItemC",150).

RUN makeDocument IN pHand (
   TABLE-HANDLE thand, /* handle to temp-table */
   TRUE,               /* Include a header? */
   "MySheet",            /* The name of the worksheet */
   hXdoc). /* An x-document handle created in this procedure */

DELETE PROCEDURE pHand.
hXdoc:SAVE("file", "c:\temp\xmlspread.xml").
DELETE OBJECT hXdoc.
 
Hi Sir,

We are running our character-based applications using ssh client.

I already solved this one just now, but I have this new problem on how to modify the columns.
Have you ever tried this one?

Regards,

Pr
 
I used the following samples for my current application.
The thing is that, my current application should modify the columns. For example, I only want column: my date, money and really a number.
to be in my excel data.

Please. If you have idea, please do share. Thank you very much. It's highly appreciated.

Regards,

Pr
 

Attachments

I used toggle boxes for modification, but the thing is, how to do the modification since the whole temp-table is being used in the process.
 
You just want to create an excel document from a temp-table?

Whats the value of converting it to XML?

Ill post some code examples of com-handles and how to use them.
 
Hi everyone!

I am new to Progress. I have lots of knowledge to learn. I beg your pardon if I ask a lot of questions.
I have this new task that makes me think terribly.
We are using OpenEdge Progress 11.3.1; Running Programs in Linux Server.

The sample codes below are my referenced codes that I used for my program.
In that, I want to modify its columns. For example, I only want the following columns to display in my excel file: Columns [my date];[money]; and [really a number].

Is it possible to modify it using toggle boxes?

Please, if you have any idea on how to do it, please please.

Thank you very much in advance.

Best regards,

Pr
 

Attachments

1. Can I insert titles? or other headers to the excel file?
e.g.
Accounting Department
Username and Date
Column headers

2. May I ask how it can be done?
There is an internal procedure called "assignTopRows", so something like this is required:
Code:
DEF temp-table topRows
  FIELD col1 AS CHAR FORMAT "xlBold".

CREATE topRows.
topRows.col1 = "Accounting Department".
CREATE topRows.
topRows.col1 = "Username and Date".
CREATE topRows.
topRows.col1 = "Column headers".

hRows = TEMP-TABLE topRows:HANDLE.

RUN assignTopRows IN pHand(TABLE-HANDLE hRows BY-REFERENCE).
 
Is it possible to modify it using toggle boxes?
Probably the best option is have a temp-table with fields for each column and a logical field to indicate you want that column for Excel. Then have a browse for this temp-table and set the logical field in the browse to VIEW-AS TOGGLE-BOX. This will allow the user to select/unselect what columns they want. Then a bit extra of extra processing to only ensure the columns selected appear in the Excel file.
 
Sir,

I've been trying them already but I can't get the result.
All I want is to transfer the handled values to a real temp-table. I don't know how to do it anymore.
I always get stucked in the buffer-handle area.

Pr.
 
Back
Top