Skip to Content
author's profile photo Former Member
Former Member

Issue with Excel when PB 12.5 application migrated for WIN 7

Hi Group,

We are currently using PB 12.5 for our application. During testing we have found

one issue while working with EXCEL on WIN7.

Below is the steps to save a powerbuilder report in EXCEL.

1. Export the content of the datawindow using saveas ascii format at temporary

folder with name as testdata.txt.

2. Write the content in "report.xls" file by reading the files generated in above


3. Open the "report.xls" and using connecttoobject do the necessary formating.

4. Save the file at desired location.

Above step is working fine on XP Machine.

This does not work when application is being run on XP machine and it give warning

message as

"The file that you are trying to open is in different format than specified by the

file extension. Verify that file is not corrupted and is from a trusted source

before opening the file. Do you want to open the file now ?"

Can anyone help with this.

I have tried creating a text document with extension .xls and opened it, it works fine with XP but does not work with WIN7 and gets the same message as above.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Posted on Jan 02, 2014 at 11:44 AM


    Why do you use the temporary solution to save data in ASCII format and convert it to Excel?

    A simplest way would be to directly use the XLSX! PowerBuilder enumerated value in your SaveAs call.

    By the way, can you precise the Excel version, the PB version and also if you are using Win7 is 32 or 64-bit?

    This is important since there is a known bug (CR#695756 fixed in build 4564) when your data contain either datetime or decimal columns.

    Hope this helps


    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 03, 2014 at 10:38 PM

    Your method is not appropriate for generating an excel file. Win 7 is warning you of this. Because XP didn't care doesn't mean it was right. Below is a simple example of getting data into a spreadsheet if you don't want to use SaveAs( ).

    string ls_data

    ls_data =

    clipboard( ls_data )

    your_ole_object.Application.ActiveSheet.Paste( )

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.