Link to home
Start Free TrialLog in
Avatar of pemurray
pemurray

asked on

Problem with saving Rich Text datawindow

All,

I am attempting to save a rich text datawindow without any success and no apparent errors.  Here is the code:

//dw_1.SaveAs("T:\CORPORATE_CLIENTS\!LETTERS\" + COMPANY + ".PDF",PDF!, FALSE)
messagebox("The Path Is:","C:\" + COMPANY + ".PDF")
//dw_1.SaveAs("C:\" + COMPANY + ".PDF",PDF!, FALSE)
dw_1.SaveAs("C:\Documents and Settings\Administrator\My Documents\!GT3\ImTrak\!Letters\dw_one.pdf", PDF!, FALSE)

I click on the command button with which the code is associated, but nothing seems to happen.  I have tried opening windows explorer and clicking F5 button cannot find anything.

Please help!!

Paul
Avatar of diasroshan
diasroshan
Flag of Kuwait image

hi paul,
first apply the patch like i have given in ur word document related post...

now what u need to try is to save the dw in some other format which is widely used like excel...
so do as follows...

dw_1.SaveAs() // don't hardcode the path or filetype

with this code it will prompt u to give a file name and also select file type as excel...

now check if it has successfully saved as excel....

well if this works then try again saving as pdf...

let me know if it works...

Cheers,
Rosh
Avatar of pemurray
pemurray

ASKER

Hi Rosh,

I applied the EBF.

Then I tried saving the document as Excel and it did write out a file that I was able to open in Excel, although I did notice that only the mail merger fields were saved (who knows, maybe that is the intent).

I then tried saving it as file type PDF! with no success.  Is it possible that having Adobe Acrobat on my machine would prevent it from working?

Thanks!

Paul
I added the following code to check for errors:

int rtncode

//dw_1.SaveAs("T:\CORPORATE_CLIENTS\!LETTERS\" + COMPANY + ".PDF",PDF!, FALSE)
//messagebox("The Path Is:","C:\" + COMPANY + ".PDF")
//dw_1.SaveAs("C:\" + COMPANY + ".PDF",PDF!, FALSE)
//rtncode = dw_1.SaveAs("C:\Documents and Settings\Administrator\My Documents\!GT3\ImTrak\!Letters\dw_one.xls", Excel!, FALSE)
rtncode = dw_1.SaveAs("C:\Documents and Settings\Administrator\My Documents\!GT3\ImTrak\!Letters\dw_one.pdf", PDF!, FALSE)
//rtncode = dw_1.SaveAs("C:\Documents and Settings\Administrator\My Documents\!GT3\ImTrak\!Letters\" + company + " CTM Letter to Service Providers.pdf", PDF!, FALSE)

messagebox("Return Code for SaveAs = ",string(rtncode))

When I save as Excel! I get a return code of 1.  When I as PDF! I get a return code of -1.
I also eliminated the arguments to the SaveAs function which causes Powerbuilder to push a Save As Dialog Navigation Box that allows you to type in the name of the file and select PDF as the save as file type.

rtncode = dw_1.SaveAs()

Unfortunately, I still got the return code of -1.
And yes I did reboot my machine after applying the EBF.
I tried saving the document as text (which worked) but I notice that it is not saving the text of my mail merged letter.  It only saves the fields which is not what I would want even if I could save as PDF.

When I print the document it works fine showing a perfectly formatted / merged letter.

Also, I found this in the documentation which seems to conflict with the SaveAs dialog box:

Using GNU Ghostscript
By default, when you select File>Save Rows As and select PDF as the file type, the data is printed to a PostScript file and automatically distilled to PDF using GNU Ghostscript.This option provides a robust solution that can save most types of DataWindow objects.

Limitations
The Ghostscript method currently does not support OLE and RichText DataWindow objects. The XSL-FO method currently does not support OLE, RichText, graph, and composite DataWindow objects.

hi,

well... going thru the net i have come across some limitations of Rich text datawindows...
please refer the following... could be of some help...

http://www.pmsys.com/pb/tips/rteissue.htm

Paul, tell me one more thing...
why have u made a dw of type rich text and why r u saving it as pdf....
probably i could give u a workaround...

Cheers,
Rosh
Well, I think I found just a ridiculous solution to the problem.

I installed Adobe Acrobat and am simply printing to the ACROBAT PDFWRITER.  There were other printers out there (not sure where they came from) but printing to Sybase DataWindow PS did not work at all and printing to Acrobat Distiller ended up with the document being printed at about 1/100 of its normal size.

dw_1.Object.DataWindow.Print.CanUseDefaultPrinter = "NO"
dw_1.Object.DataWindow.Print.Orientation = 1
dw_1.Object.DataWindow.Print.PrinterName = "ACROBAT PDFWRITER"
//dw_1.Object.DataWindow.Print.PrinterName = "Sybase DataWindow PS"
//dw_1.Object.DataWindow.Print.PrinterName = "Acrobat Distiller"

dw_1.Object.DataWindow.Print.Prompt = "YES"
dw_1.print()

I don't consider this a real solution but I can use it until someone can hopefully point a better solution.

Paul
Rosh,

Can I package this up with my executable?

Paul
I tried that along with the XOL... option

dw_1.object.DataWindow.Export.PDF.Method = Distill!

No help...

Have you been able to do this?

Thanks!

Paul
hi paul,

i dont have PB 9 so cannot try it out myself...

but if u can answer my earlier post i can give u a work around if i know why u r using pdf..

Rosh
Sorry, there are so many posts I don't know which you mean.

Have you been able to do this in any PB version?

Paul
Paul, tell me one more thing...
why have u made a dw of type rich text and why r u saving it as pdf....
probably i could give u a workaround...

Cheers,
Rosh
ASKER CERTIFIED SOLUTION
Avatar of sajuks
sajuks

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for the points and grade.