Using delimiter while creating excel sheet in progress 4gl

pri_252

New Member
I have 3 .txt files and I am using COM-Handle to create an Excel sheet. Can anyone help me how to set the delimiter? My Excel sheet is getting created but the columns are not comma separated.
 

Attachments

  • test.xlsx
    9.2 KB · Views: 6

joey.jeremiah

ProgressTalk Moderator
Staff member
sorry if this comes off a bit strong but I don't understand why anyone would use com handles to create office files.

just a few reasons why not to use com handles - it is windows only, extremely slow, uses a ton of resources, horrible server side solution, definitely doesn't scale and even microsoft have officially said a decade ago it is a deprecated technology replaced by openxml.

in comparison with openxml you could create a file in milliseconds with almost no resources and it's cross platform.

i wrote an openxml tool for creating word and excel files which is free, commercial friendly open source and well documented which you can download from docxfactory.com but you don't have to use this project there are many other openxml tools to choose from.
 

pri_252

New Member
Code:
DEFINE TEMP-TABLE tt-arq
FIELD nomeArq AS CHAR.
CREATE tt-arq.
tt-arq.nomeArq = "C:\damgra\excel\Test1.txt".
CREATE tt-arq.
tt-arq.nomeArq = "C:\damgra\excel\Test2.txt".
CREATE tt-arq.
tt-arq.nomeArq = "C:\damgra\excel\Test3.txt".


CREATE "excel.application" chExcel.

iQtArq = 0.

FOR EACH tt-arq.
iQtArq = iQtArq + 1.

IF iQtArq = 1 THEN DO:   
chWorkbook1=chExcel:Workbooks:Open(tt-arq.nomeArq).
chWorksheet1=chWorkbook1:Worksheets(1).
chWorksheet1:NAME = "test" + STRING(iQtArq).
NEXT.
END.

iPos = chWorkbook1:sheets:COUNT .

chWorkbook2=chExcel:Workbooks:Open(tt-arq.nomeArq).

DO idx = 1 TO (chWorkbook2:sheets:COUNT):
iPos = iPos + 1.
chWorksheet2=chWorkbook2:Worksheets(idx).
chWorksheet2:NAME = "plan" + STRING(iPos).
END.

chWorksheet2=chWorkbook2:Worksheets(1).
chWorksheet1=chWorkbook1:Worksheets(chWorkbook1:sheets:COUNT).
chWorksheet1:Activate.
chWorkbook2:Sheets:move(,chWorksheet1).   
END.

chWorksheet1=chWorkbook1:Worksheets(1).
chWorksheet1:Activate.

chExcel:visible=true.

IF valid-handle(chWorksheet1) THEN RELEASE OBJECT chWorksheet1.
IF valid-handle(chWorksheet2) THEN RELEASE OBJECT chWorksheet2.
IF valid-handle(chWorkbook1 ) THEN RELEASE OBJECT chWorkbook1 .
IF valid-handle(chWorkbook2 ) THEN RELEASE OBJECT chWorkbook2 .
IF valid-handle(chExcel )     THEN RELEASE OBJECT chExcel.
 
Last edited by a moderator:
Top