Loading Temp tables between .p files

Irimis

New Member
Ok this is really hard to explain so I will try. I have come across a program that exports to excel, but some of the data contains leading 0's which need to be displayed, as with out it the data is wrong. First off is there a way to format the cells before data is placed in excel. I know the format is
cColLabel = colReference(INTEGER(ENTRY(i,caccountcols))).
ASSIGN chRange = chWorkSheet:Range(cColLabel + ":" + cColLabel).
chRange:NumberFormat = "@". (chRange being com-handle)
to make the column text format, but the leading zeros are cut out before this is formatted. I have tried placing before the data is writen but only receive errors.

So after talking with another programmer we came up with making a temp-table which when needed will save the cell location and format for that cell. How can I load this temp table in the formatting .p file when it is created in the .p file which does the exporting?

Being I am an intern its hard to get alot of help when other programmers here are very busy. Thanks in advance for any help.
 
Inside of excel when you want to type 001 into a cell, it changes it to 1 (cause its a numeric value, but if you put a '001 (single quote) it will show 001. Will that help your case.
 
it works for me? oe10b, office 2k3
can you please try it, maybe that isn't the problem?

<snippet>
define var chExcelApplication as com-handle.
define var chWorkbook as com-handle.
define var chWorksheet as com-handle.

create "Excel.Application" chExcelApplication.
chExcelApplication:Visible = yes.
chWorkbook = chExcelApplication:Workbooks:Add().
chWorkSheet = chExcelApplication:Sheets:Item(1).

chWorkSheet:Cells:NumberFormat = "@".
/* chWorksheet:Range("A1"):NumberFormat = "@". */
chWorksheet:Range("A1") = "00000001".

release object chExcelApplication.
release object chWorkbook.
release object chWorksheet.
</snippet>
 
You should assign the format before the range:
you do this (see your first post):
Code:
ASSIGN chRange = chWorkSheet:Range(cColLabel + ":" + cColLabel). 
chRange:NumberFormat = "@". (chRange being com-handle)

But what will probably work ( haven't actually tested it, but joey has, see his post) is:
Code:
chWorkSheet:Cells:NumberFormat = "@".
/* chWorksheet:Range("A1"):NumberFormat = "@". */
chWorksheet:Range("A1") = "00000001".
 
Irimis said:
How can I load this temp table in the formatting .p file when it is created in the .p file which does the exporting?


You can pass temp-table (or temp-table handle) as a parameter. See DEFINE PARAMETER in Help.

btw. You being 'only an intern' is not an excuse for your co-programmers not helping you, but it is reasonable to push juniors to solve the problem on their own. Hopefully that is your managements thinking.

Lee
 
The only problem with the formatting was that the data was being placed before the formatting, so the 000XXXXX was being replaced with XXXXX and then formatted. All the data was loaded in to a temp file then loaded to excel. Just the way it is set up to run here.

Thanks, I was passing it in as the wrong parameter, well not defined correctly. Was trying to pass it in as just a reg input parameter and not a temp table.
 
Back
Top