BobyIsProgress
Member
OS: Windows Server 2012 R2
Progress: 10.2B.08
Hello guyz,
So I recently tried to enhanced our program that generate excel file.
Current version:
1. Generate csv file
2. Launch excel by progress
3. Open the csv file
4. Saving it as an xlsx file.
Our main issue with this version is for text value. If the value is starting by 0 like this 00045600 (a product ref by example) excel will prompt 45600 .
So by brosing forum and willing to do that I do by hand I choose to use the opentextfile method of excel directly in progress like this:
The main issue there is that excel expect an array of array. And I didn't found a way to do it.
So if it works in .NET why not doing with .NET code called by a progress procedure.
I did create one that I would like to test
But now I don't find a way to use it in my progress procedure:
Progress is telling me that he can't found the interface or class corresponding to it. I believe it because I don't how to tell him where to found it.
So my questions are as folow:
1. Is there another way of doing it
2. How can I use homemade Class (C# or Progress) with the appbuilder
Best Regards and thanks in advance
Progress: 10.2B.08
Hello guyz,
So I recently tried to enhanced our program that generate excel file.
Current version:
1. Generate csv file
2. Launch excel by progress
3. Open the csv file
4. Saving it as an xlsx file.
Our main issue with this version is for text value. If the value is starting by 0 like this 00045600 (a product ref by example) excel will prompt 45600 .
So by brosing forum and willing to do that I do by hand I choose to use the opentextfile method of excel directly in progress like this:
Code:
DEFINE VARIABLE myFieldFormat AS INTEGER EXTENT 4 NO-UNDO.
excelAppl:Workbooks:OpenText(toto,
,
,
{&xlDelimited},
{&xlTextQualifierDoubleQuote},
FALSE,
FALSE,
TRUE,
FALSE,
FALSE,
FALSE,
,
myFieldFormat,
,
,
,
,
TRUE) .
The main issue there is that excel expect an array of array. And I didn't found a way to do it.
So if it works in .NET why not doing with .NET code called by a progress procedure.
I did create one that I would like to test
C#:
using System;
using Excel = Microsoft.Office.Interop.Excel; // Will need Excel fonctionnality
namespace OpenTxtFileExcel; // Name space of the class
public class OpenTextFileExcel // Class
{
public string myTxtFile; // path of the input TXT file
public string myExcelFile; // path of the output xlsx file
public string fieldFormat; // data format field list to be translate in an array of array
public void Open()
{
Excel.Application myExcel = new Excel.Application() ; // initiate excel
if (myExcel != null) // If excel is running then go
{
// Create the workbook
Excel.Workbooks myWB = myExcel.Workbooks ;
// Open the text file
myWB.OpenText(myTxtFile,,xlDelimited,xlTextQualifierDoubleQuote,,,TRUE,,,,,,,,,,TRUE) ;
// Saving it as xlsx file
myWB.SaveAs(myExcelFile,51,,,,,,2);
}
}
}
But now I don't find a way to use it in my progress procedure:
Code:
DEFINE VARIABLE maClass AS CLASS OpenTextFile .
So my questions are as folow:
1. Is there another way of doing it
2. How can I use homemade Class (C# or Progress) with the appbuilder
Best Regards and thanks in advance