how to print two pages or more in datagrid

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
blairetabay
Posts: 34
Joined: Mon Feb 24, 2014 10:12 am

how to print two pages or more in datagrid

Post by blairetabay » Tue May 06, 2014 2:58 am

i'm a new user of LC.

A serious problem appear on my print a stack

after i have created a stack that will print everything works will. i loop the value of the data grid to fit to my needs,

From here everything just work accordingly on just 1 page of document.

Problem is i have lot of documents pages to be print.

any suggestion will do.

thanks in advance.

best for all.

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 9785
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: how to print two pages or more in datagrid

Post by dunbarx » Tue May 06, 2014 2:14 pm

Hi.

There are a number of ways to print multiple pages. Please read the dictionary on the "revPrintText" command.

Craig Newman

DavJans
Posts: 273
Joined: Thu Dec 12, 2013 4:21 pm
Location: Spokane, WA USA

Re: how to print two pages or more in datagrid

Post by DavJans » Wed May 14, 2014 5:55 pm

Here is how I did it, probably not even close to the best way but it works for me. Basically I create a .htm and print it from google chrome

Code: Select all

on mouseUp
   local tFileName, tFileContents, tDate, tDataLineTemp, htmlScript
   put short date into tDate
   replace "/" with "-" in tDate
   put "//mfcpdc2/qc/Metals Fab tracker/Reports/" & tDate  & " " & fld "Job" & " NDT Report.htm" into tFileName
   
   put the dgProp[ "columns" ] of group "DataGrid 1" into tColumnTitles

   replace "tracker" with "" in tColumnTitles
   put "<table border=" & quote & "1" & quote & ">" & return & "<thead><tr>" into htmlScript
   put 1 into lNumber
   repeat with x = 1 to the number of lines of tColumnTitles
      put "<th title=" & quote & "Field #" & lNumber & quote &">" before line x of tColumnTitles
      put "</th>" after line x of tColumnTitles
      put lNumber + 1 into lNumber
   end repeat
   put tColumnTitles after htmlScript
   put return & "</tr></thead>" & return & "<tbody>" after htmlScript
   
   put the dgText of group "DataGrid 1" into tData
   repeat with x = 1 to the number of lines of tData
      put line x of tData into tDataLineTemp
      replace Tab with return in tDataLineTemp
      repeat with y = 1 to the number of lines of tDataLineTemp
         put "<td align=" & quote & "left" & quote & ">" before  line y of tDataLineTemp
         put "</td>" after line y of tDataLineTemp
      end repeat
      put "<tr>" before tDataLineTemp
      put return & "</tr>" & return after tDataLineTemp
      put tDataLineTemp after htmlScript
   end repeat
   put htmlScript into URL ("file:" & tFileName)
   launch url ("file:" & tFileName)
end mouseUp
"Det bästa stället att hitta en hjälpande hand är i slutet av din egen arm" förutom här

miguelchang
Posts: 1
Joined: Thu Sep 11, 2014 5:26 pm

Re: how to print two pages or more in datagrid

Post by miguelchang » Thu Apr 23, 2015 11:49 pm

Hello Dav im having some problems with launch url, when i use it with a simple url it opens chrome and launch that url, but when i try to open the htm file that you created with your script chrome doesnt do it.

maybe u can help me with that.

Regards

DavJans wrote:Here is how I did it, probably not even close to the best way but it works for me. Basically I create a .htm and print it from google chrome

DavJans
Posts: 273
Joined: Thu Dec 12, 2013 4:21 pm
Location: Spokane, WA USA

Re: how to print two pages or more in datagrid

Post by DavJans » Mon Apr 27, 2015 11:28 pm

put short date into tDate
replace "/" with "-" in tDate
put "//mfcpdc2/qc/Metals Fab tracker/Reports/" & tDate & " " & fld "Job" & " NDT Report.htm" into tFileName

here is the script where I create the html file, it is putting it on my server (//mfcpdc2/) make sure you change that to your server or local C: or it wont be able to save the file for chrome to open.

maybe post your adapted script?
"Det bästa stället att hitta en hjälpande hand är i slutet av din egen arm" förutom här

Post Reply

Return to “Getting Started with LiveCode - Complete Beginners”