on 07-02-2015 7:01 AM
I have a data window which has multiple pages in it. Requirement is to save the file with first page (only one page) onto a database table.
But when I try with saveas it saves complete datawindow (all pages).
Is there a way to save only first page (or n th page) of a datawindow to a file ?
Appreciate your help!
Thanks,
Harish P M
Delete enough rows so that there is only one page left. And if they're needed after saving, undelete them.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
We use a print dialog window to allow the user to specify what they want to print. But you can use the code inside if you just want to set it programmatically.
To call the window you just pass the DW or DS...
window W
OpenWithParm( W, dw_list, "w_dwprint_nofile" )
If (1 = Message.DoubleParm) then w_main.tab_1.tabpage_1.dw_list.Print()
Code to specify what pages to print...
string Mod = " " // the modify syntax that will be built
string Row // The first row on page
// Page range
Mod += " datawindow.print.page.range="
If this.rb_pageall.Checked then
// print all of the pages
Mod += "''"
Elseif this.rb_pagecurrent.Checked then
// print just the current page.
If This.IsDataStore then
Row = this.DS.Describe( "datawindow.firstrowonpage" )
Mod += "'" + this.DS.Describe( "Evaluate('page()'," + Row + ")" ) + "'"
Else
Row = this.DW.Describe( "datawindow.firstrowonpage" )
Mod += "'" + this.DW.Describe( "Evaluate('page()'," + Row + ")" ) + "'"
End If
Elseif this.rb_pagerange.Checked then
// print the defined range.
Mod += "'" + this.sle_pagerange.Text + "'"
End If
Mod += " datawindow.print.copies=" + this.sle_copies.Text
Mod += " datawindow.print.prompt=no"
Mod += " datawindow.print.collate=" + ifs( this.cbx_collate.Checked, "yes", "no" )
Mod += " datawindow.print.quality=" + String( this.ddlb_quality.FindItem( this.ddlb_quality.Text, 0 ) - 1 )
Mod += " datawindow.print.page.rangeinclude=" + String( this.ddlb_oddeven.FindItem( this.ddlb_oddeven.Text, 0 ) - 1 )
// Set the datawindow attribs
If This.IsDataStore Then
this.DS.Modify( Mod )
Else
this.DW.Modify( Mod )
End If
Link to download object...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Well, never seen this one before, or at least don't know anyone who ever needed it.
Are you able to print to PDF?
Then you should be able to control it in the printpage event with something like:
IF pagenumber > 1 THEN This.PrintCancel()
Otherwise, do you know which rows are on the first page or who many?
Then you could create a datastore with the same dataobject and CopyRows to it; just a thought.
Or do you have totals or groups on that first page?
Ben
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
What file type you want to save to? It sounds like you want to save the page, not the data itself so I'm wondering if a Print to pdf file won't meet your requirements? When printing, you can specify pages to print.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Harish;
Suggestion: try using a Filter () command for the PageNo () = nn. (just a thought - not sure that will work).
Regards ... Chris
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
9 | |
8 | |
6 | |
6 | |
6 | |
5 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.