Sybase NNTP forums - End Of Life (EOL)

The NNTP forums from Sybase - forums.sybase.com - are now closed.

All new questions should be directed to the appropriate forum at the SAP Community Network (SCN).

Individual products have links to the respective forums on SCN, or you can go to SCN and search for your product in the search box (upper right corner) to find your specific developer center.

Export/SaveAs a PB data window to MS Excel File

11 posts in DataWindow Last posting was on 2012-10-31 12:09:12Z
Vicky Chan Posted on 2012-10-29 08:44:09Z
Sender: 5feb.508e37af.1804289383@sybase.com
From: Vicky Chan
Newsgroups: sybase.public.powerbuilder.datawindow
Subject: Export/SaveAs a PB data window to MS Excel File
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <508e41d9.62c2.1681692777@sybase.com>
NNTP-Posting-Host: 172.20.134.41
X-Original-NNTP-Posting-Host: 172.20.134.41
Date: 29 Oct 2012 00:44:09 -0800
X-Trace: forums-1-dub 1351500249 172.20.134.41 (29 Oct 2012 00:44:09 -0800)
X-Original-Trace: 29 Oct 2012 00:44:09 -0800, 172.20.134.41
Lines: 22
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.datawindow:94636
Article PK: 414234

Hi Experts,
Our powerbuilder application generates a reports by printing
a datawindow as a PDF file. Now we would like to modify the
PB such that an excel file is generated instead of a PDF
file.
In my PB code i tried using the following function:

public function integer save_dw_to_file (datawindow
adw_datawindow, string as_filename, string as_folder);
string ls_tmp_file_xls
ls_tmp_file_xls = as_filename+'_temp.xls'
adw_datawindow.saveas(ls_tmp_file_xls,htmltable!,true)
return 1
end function

Note: adw_datawindow is the datawindow that i want to print;
as_filename is the output filename.

However, this seems not work coz i got error when i open the
file (see openfile.jpg)

Thanks in Advance!


Vicky Chan Posted on 2012-10-29 08:45:09Z
Sender: 5feb.508e37af.1804289383@sybase.com
From: Vicky Chan
Newsgroups: sybase.public.powerbuilder.datawindow
Subject: Re: Export/SaveAs a PB data window to MS Excel File
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <508e4215.62de.1681692777@sybase.com>
References: <508e41d9.62c2.1681692777@sybase.com>
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="-=_forums-1-dub508e4215"
NNTP-Posting-Host: 172.20.134.41
X-Original-NNTP-Posting-Host: 172.20.134.41
Date: 29 Oct 2012 00:45:09 -0800
X-Trace: forums-1-dub 1351500309 172.20.134.41 (29 Oct 2012 00:45:09 -0800)
X-Original-Trace: 29 Oct 2012 00:45:09 -0800, 172.20.134.41
Lines: 993
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.datawindow:94637
Article PK: 414235

Added Attachment.

> Hi Experts,
> Our powerbuilder application generates a reports by
> printing a datawindow as a PDF file. Now we would like to
> modify the PB such that an excel file is generated instead
> of a PDF file.
> In my PB code i tried using the following function:
>
> public function integer save_dw_to_file (datawindow
> adw_datawindow, string as_filename, string as_folder);
> string ls_tmp_file_xls
> ls_tmp_file_xls = as_filename+'_temp.xls'
> adw_datawindow.saveas(ls_tmp_file_xls,htmltable!,true)
> return 1
> end function
>
> Note: adw_datawindow is the datawindow that i want to
> print; as_filename is the output filename.
>
> However, this seems not work coz i got error when i open
> the file (see openfile.jpg)
>
> Thanks in Advance!

OpenFile.jpg

Andreas Mykonios Posted on 2012-10-31 12:09:12Z
From: Andreas Mykonios <Andreas Mykonios>
Newsgroups: sybase.public.powerbuilder.datawindow
Subject: Re: Export/SaveAs a PB data window to MS Excel File
Message-ID: <i25298hot6kvlin5sh3ohqf8mhhpske69h@4ax.com>
References: <508e41d9.62c2.1681692777@sybase.com> <508e4215.62de.1681692777@sybase.com>
X-Newsreader: Forte Agent 4.2/32.1118
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Date: 31 Oct 2012 04:09:12 -0800
X-Trace: forums-1-dub 1351685352 172.20.134.152 (31 Oct 2012 04:09:12 -0800)
X-Original-Trace: 31 Oct 2012 04:09:12 -0800, vip152.sybase.com
Lines: 30
X-Authenticated-User: pb125beta
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.datawindow:94651
Article PK: 414247

You can do it like that and then open the html using excel com objects
and save it as an xls file (or whatever you want).

Andreas.

On 29 Oct 2012 00:45:09 -0800, Vicky Chan wrote:

>Added Attachment.
>> Hi Experts,
>> Our powerbuilder application generates a reports by
>> printing a datawindow as a PDF file. Now we would like to
>> modify the PB such that an excel file is generated instead
>> of a PDF file.
>> In my PB code i tried using the following function:
>>
>> public function integer save_dw_to_file (datawindow
>> adw_datawindow, string as_filename, string as_folder);
>> string ls_tmp_file_xls
>> ls_tmp_file_xls = as_filename+'_temp.xls'
>> adw_datawindow.saveas(ls_tmp_file_xls,htmltable!,true)
>> return 1
>> end function
>>
>> Note: adw_datawindow is the datawindow that i want to
>> print; as_filename is the output filename.
>>
>> However, this seems not work coz i got error when i open
>> the file (see openfile.jpg)
>>
>> Thanks in Advance!


Andrea Rimicci Posted on 2012-10-29 11:02:59Z
From: Andrea Rimicci <seemysig@qq.net>
Newsgroups: sybase.public.powerbuilder.datawindow
Subject: Re: Export/SaveAs a PB data window to MS Excel File
Organization: Elle s.n.c.
Message-ID: <cdos88p01221501obadhuqkjpka2ibh8oq@4ax.com>
References: <508e41d9.62c2.1681692777@sybase.com>
X-Newsreader: Forte Agent 3.3/32.846
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Date: 29 Oct 2012 03:02:59 -0800
X-Trace: forums-1-dub 1351508579 172.20.134.152 (29 Oct 2012 03:02:59 -0800)
X-Original-Trace: 29 Oct 2012 03:02:59 -0800, vip152.sybase.com
Lines: 9
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.datawindow:94639
Article PK: 414237


>... we would like to modify the
>PB such that an excel file is generated instead of a PDF
>file...
>adw_datawindow.saveas(ls_tmp_file_xls,htmltable!,true)...

You can check the SaveAs datawindow method specification, and then use
the correct saveastype parameter.
--
andrea - ar italy, com


Chris Pollach Posted on 2012-10-29 11:48:18Z
From: Chris Pollach <cpollach@travel-net.com>
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:16.0) Gecko/20121010 Thunderbird/16.0.1
MIME-Version: 1.0
Newsgroups: sybase.public.powerbuilder.datawindow
Subject: Re: Export/SaveAs a PB data window to MS Excel File
References: <508e41d9.62c2.1681692777@sybase.com>
In-Reply-To: <508e41d9.62c2.1681692777@sybase.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <508e6d02$1@forums-1-dub>
Date: 29 Oct 2012 03:48:18 -0800
X-Trace: forums-1-dub 1351511298 172.20.134.152 (29 Oct 2012 03:48:18 -0800)
X-Original-Trace: 29 Oct 2012 03:48:18 -0800, vip152.sybase.com
Lines: 41
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.datawindow:94640
Article PK: 414238

Hi Vicky;

You are requesting and HTML report by using the "htmltable!"
parameter. You need to specify "Excel8!" instead.

--
Regards ... Chris
President: OSUG / STD Inc.
Vice President: ISUG
Blog: http://chrispollach.blogspot.com
SourceForge: http://sourceforge.net/projects/stdfndclass
PBDJ: http://chrispollach.sys-con.com

On 10/29/2012 4:44 AM, Vicky Chan wrote:
> Hi Experts,
> Our powerbuilder application generates a reports by printing
> a datawindow as a PDF file. Now we would like to modify the
> PB such that an excel file is generated instead of a PDF
> file.
> In my PB code i tried using the following function:
>
> public function integer save_dw_to_file (datawindow
> adw_datawindow, string as_filename, string as_folder);
> string ls_tmp_file_xls
> ls_tmp_file_xls = as_filename+'_temp.xls'
> adw_datawindow.saveas(ls_tmp_file_xls,htmltable!,true)
> return 1
> end function
>
> Note: adw_datawindow is the datawindow that i want to print;
> as_filename is the output filename.
>
> However, this seems not work coz i got error when i open the
> file (see openfile.jpg)
>
> Thanks in Advance!
>


Jason 'Bug' Fenter [TeamSybase] Posted on 2012-10-29 18:01:31Z
From: "Jason 'Bug' Fenter [TeamSybase]" <jason.fenter@teamsybase.com>
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:16.0) Gecko/20121010 Thunderbird/16.0.1
MIME-Version: 1.0
Newsgroups: sybase.public.powerbuilder.datawindow
Subject: Re: Export/SaveAs a PB data window to MS Excel File
References: <508e41d9.62c2.1681692777@sybase.com> <508e6d02$1@forums-1-dub>
In-Reply-To: <508e6d02$1@forums-1-dub>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <508ec47b@forums-1-dub>
Date: 29 Oct 2012 10:01:31 -0800
X-Trace: forums-1-dub 1351533691 172.20.134.152 (29 Oct 2012 10:01:31 -0800)
X-Original-Trace: 29 Oct 2012 10:01:31 -0800, vip152.sybase.com
Lines: 15
X-Authenticated-User: teamsybase
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.datawindow:94642
Article PK: 414240

In order to retain the presentation of your datawindow once it's saved
to Excel, you'll need to use a tool like dw2xls. Simply saving as
Excel8! will only retain your data-- which might be all you really
want-- but it doesn't maintain formatting or layout. The dw2xls tool
retains layout as well.

On 10/29/2012 6:48 AM, Chris Pollach wrote:
>
> Hi Vicky;
>
> You are requesting and HTML report by using the "htmltable!"
> parameter. You need to specify "Excel8!" instead.
>


Vicky Chan Posted on 2012-10-30 04:40:16Z
Sender: 3648.508f31ac.1804289383@sybase.com
From: Vicky Chan
Newsgroups: sybase.public.powerbuilder.datawindow
Subject: Re: Export/SaveAs a PB data window to MS Excel File
X-Mailer: WebNews to Mail Gateway v1.1t
Message-ID: <508f5a30.43cc.1681692777@sybase.com>
References: <508ec47b@forums-1-dub>
NNTP-Posting-Host: 172.20.134.41
X-Original-NNTP-Posting-Host: 172.20.134.41
Date: 29 Oct 2012 20:40:16 -0800
X-Trace: forums-1-dub 1351572016 172.20.134.41 (29 Oct 2012 20:40:16 -0800)
X-Original-Trace: 29 Oct 2012 20:40:16 -0800, 172.20.134.41
Lines: 36
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.datawindow:94645
Article PK: 414243

Hi Jason,

Thanks for your information. I also found dw2xls through
google. But may i ask is it free third party tool? If not,
is that only i can do is to save the data from my datawindow
without formatting and layout?

Hi Chris,

Thanks for your information. I tried the following SaveAs()
method calls but not succeed:
adw_datawindow.saveas(ls_tmp_file_xls + '1.xls', Excel!,
true);
adw_datawindow.saveas(ls_tmp_file_xls + '2.xls', Excel5!,
true);
adw_datawindow.saveas(ls_tmp_file_xls + '3.xls', Excel8!,
true);
adw_datawindow.saveas(ls_tmp_file_xls + '4.xls', HtmlTable!,
true);

> In order to retain the presentation of your datawindow
> once it's saved to Excel, you'll need to use a tool like
> dw2xls. Simply saving as Excel8! will only retain your
> data-- which might be all you really want-- but it
> doesn't maintain formatting or layout. The dw2xls tool
> retains layout as well.
>
>
>
> On 10/29/2012 6:48 AM, Chris Pollach wrote:
> >
> > Hi Vicky;
> >
> > You are requesting and HTML report by using the
> > "htmltable!" parameter. You need to specify "Excel8!"
> instead. >


Chris Pollach Posted on 2012-10-30 11:45:38Z
From: Chris Pollach <cpollach@travel-net.com>
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:16.0) Gecko/20121010 Thunderbird/16.0.1
MIME-Version: 1.0
Newsgroups: sybase.public.powerbuilder.datawindow
Subject: Re: Export/SaveAs a PB data window to MS Excel File
References: <508ec47b@forums-1-dub> <508f5a30.43cc.1681692777@sybase.com>
In-Reply-To: <508f5a30.43cc.1681692777@sybase.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <508fbde2$1@forums-1-dub>
Date: 30 Oct 2012 03:45:38 -0800
X-Trace: forums-1-dub 1351597538 172.20.134.152 (30 Oct 2012 03:45:38 -0800)
X-Original-Trace: 30 Oct 2012 03:45:38 -0800, vip152.sybase.com
Lines: 55
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.datawindow:94647
Article PK: 414244

Hi Vicky;

Remember if you use the Excel8! option that you have to have the .Net
run time framework installed.

BTW: What errors did you get?

--
Regards ... Chris
President: OSUG / STD Inc.
Vice President: ISUG
Blog: http://chrispollach.blogspot.com
SourceForge: http://sourceforge.net/projects/stdfndclass
PBDJ: http://chrispollach.sys-con.com

On 10/30/2012 12:40 AM, Vicky Chan wrote:
> Hi Jason,
>
> Thanks for your information. I also found dw2xls through
> google. But may i ask is it free third party tool? If not,
> is that only i can do is to save the data from my datawindow
> without formatting and layout?
>
> Hi Chris,
>
> Thanks for your information. I tried the following SaveAs()
> method calls but not succeed:
> adw_datawindow.saveas(ls_tmp_file_xls + '1.xls', Excel!,
> true);
> adw_datawindow.saveas(ls_tmp_file_xls + '2.xls', Excel5!,
> true);
> adw_datawindow.saveas(ls_tmp_file_xls + '3.xls', Excel8!,
> true);
> adw_datawindow.saveas(ls_tmp_file_xls + '4.xls', HtmlTable!,
> true);
>
>> In order to retain the presentation of your datawindow
>> once it's saved to Excel, you'll need to use a tool like
>> dw2xls. Simply saving as Excel8! will only retain your
>> data-- which might be all you really want-- but it
>> doesn't maintain formatting or layout. The dw2xls tool
>> retains layout as well.
>>
>>
>>
>> On 10/29/2012 6:48 AM, Chris Pollach wrote:
>>>
>>> Hi Vicky;
>>>
>>> You are requesting and HTML report by using the
>>> "htmltable!" parameter. You need to specify "Excel8!"
>> instead. >


Chris Pollach Posted on 2012-10-30 11:46:22Z
From: Chris Pollach <cpollach@travel-net.com>
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:16.0) Gecko/20121010 Thunderbird/16.0.1
MIME-Version: 1.0
Newsgroups: sybase.public.powerbuilder.datawindow
Subject: Re: Export/SaveAs a PB data window to MS Excel File
References: <508ec47b@forums-1-dub> <508f5a30.43cc.1681692777@sybase.com>
In-Reply-To: <508f5a30.43cc.1681692777@sybase.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <508fbe0e$1@forums-1-dub>
Date: 30 Oct 2012 03:46:22 -0800
X-Trace: forums-1-dub 1351597582 172.20.134.152 (30 Oct 2012 03:46:22 -0800)
X-Original-Trace: 30 Oct 2012 03:46:22 -0800, vip152.sybase.com
Lines: 43
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.datawindow:94648
Article PK: 414246

FYI: "dw2xls" is *not* free.

On 10/30/2012 12:40 AM, Vicky Chan wrote:
> Hi Jason,
>
> Thanks for your information. I also found dw2xls through
> google. But may i ask is it free third party tool? If not,
> is that only i can do is to save the data from my datawindow
> without formatting and layout?
>
> Hi Chris,
>
> Thanks for your information. I tried the following SaveAs()
> method calls but not succeed:
> adw_datawindow.saveas(ls_tmp_file_xls + '1.xls', Excel!,
> true);
> adw_datawindow.saveas(ls_tmp_file_xls + '2.xls', Excel5!,
> true);
> adw_datawindow.saveas(ls_tmp_file_xls + '3.xls', Excel8!,
> true);
> adw_datawindow.saveas(ls_tmp_file_xls + '4.xls', HtmlTable!,
> true);
>
>> In order to retain the presentation of your datawindow
>> once it's saved to Excel, you'll need to use a tool like
>> dw2xls. Simply saving as Excel8! will only retain your
>> data-- which might be all you really want-- but it
>> doesn't maintain formatting or layout. The dw2xls tool
>> retains layout as well.
>>
>>
>>
>> On 10/29/2012 6:48 AM, Chris Pollach wrote:
>>>
>>> Hi Vicky;
>>>
>>> You are requesting and HTML report by using the
>>> "htmltable!" parameter. You need to specify "Excel8!"
>> instead. >


Scott Morris Posted on 2012-10-30 12:39:10Z
Content-Type: text/plain; charset=iso-8859-15; format=flowed; delsp=yes
Newsgroups: sybase.public.powerbuilder.datawindow
Subject: Re: Export/SaveAs a PB data window to MS Excel File
References: <508ec47b@forums-1-dub> <508f5a30.43cc.1681692777@sybase.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
From: "Scott Morris" <bogus@abc.def>
Message-ID: <op.wmzr3jeeq59cbq@scott-win7.divinv.net>
User-Agent: Opera Mail/11.51 (Win32)
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Date: 30 Oct 2012 04:39:10 -0800
X-Trace: forums-1-dub 1351600750 172.20.134.152 (30 Oct 2012 04:39:10 -0800)
X-Original-Trace: 30 Oct 2012 04:39:10 -0800, vip152.sybase.com
Lines: 12
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.datawindow:94649
Article PK: 414248


On Tue, 30 Oct 2012 00:40:16 -0400, Vicky <Chan> wrote:

> adw_datawindow.saveas(ls_tmp_file_xls + '4.xls', HtmlTable!,
> true);

This logic - which is what you originally posted - is nonsense. You are
saving the file as one format but using an extension that implies a very
different format. That is the original reason for the error message in
Excel. You can try your original logic and use the correct extension -
".html". That may work for you. If not, then perhaps you should revisit
the requirement to save the visual presentation in a format that is
acceptable for Excel - especially if you want something that is free.


Jason 'Bug' Fenter [TeamSybase] Posted on 2012-10-30 15:39:41Z
From: "Jason 'Bug' Fenter [TeamSybase]" <jason.fenter@teamsybase.com>
User-Agent: Mozilla/5.0 (Windows NT 5.1; rv:16.0) Gecko/20121026 Thunderbird/16.0.2
MIME-Version: 1.0
Newsgroups: sybase.public.powerbuilder.datawindow
Subject: Re: Export/SaveAs a PB data window to MS Excel File
References: <508ec47b@forums-1-dub> <508f5a30.43cc.1681692777@sybase.com>
In-Reply-To: <508f5a30.43cc.1681692777@sybase.com>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
NNTP-Posting-Host: vip152.sybase.com
X-Original-NNTP-Posting-Host: vip152.sybase.com
Message-ID: <508ff4bd$1@forums-1-dub>
Date: 30 Oct 2012 07:39:41 -0800
X-Trace: forums-1-dub 1351611581 172.20.134.152 (30 Oct 2012 07:39:41 -0800)
X-Original-Trace: 30 Oct 2012 07:39:41 -0800, vip152.sybase.com
Lines: 41
X-Authenticated-User: teamsybase
Path: forums-1-dub!not-for-mail
Xref: forums-1-dub sybase.public.powerbuilder.datawindow:94650
Article PK: 414249

dw2xls is not free, but many would say that it's well worth the money.

On 10/29/2012 11:40 PM, Vicky Chan wrote:
> Hi Jason,
>
> Thanks for your information. I also found dw2xls through
> google. But may i ask is it free third party tool? If not,
> is that only i can do is to save the data from my datawindow
> without formatting and layout?
>
> Hi Chris,
>
> Thanks for your information. I tried the following SaveAs()
> method calls but not succeed:
> adw_datawindow.saveas(ls_tmp_file_xls + '1.xls', Excel!,
> true);
> adw_datawindow.saveas(ls_tmp_file_xls + '2.xls', Excel5!,
> true);
> adw_datawindow.saveas(ls_tmp_file_xls + '3.xls', Excel8!,
> true);
> adw_datawindow.saveas(ls_tmp_file_xls + '4.xls', HtmlTable!,
> true);
>
>> In order to retain the presentation of your datawindow
>> once it's saved to Excel, you'll need to use a tool like
>> dw2xls. Simply saving as Excel8! will only retain your
>> data-- which might be all you really want-- but it
>> doesn't maintain formatting or layout. The dw2xls tool
>> retains layout as well.
>>
>>
>>
>> On 10/29/2012 6:48 AM, Chris Pollach wrote:
>>>
>>> Hi Vicky;
>>>
>>> You are requesting and HTML report by using the
>>> "htmltable!" parameter. You need to specify "Excel8!"
>> instead. >