Page 1 of 1

how to print two pages or more in datagrid

Posted: Tue May 06, 2014 2:58 am
by blairetabay
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.

Re: how to print two pages or more in datagrid

Posted: Tue May 06, 2014 2:14 pm
by dunbarx
Hi.

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

Craig Newman

Re: how to print two pages or more in datagrid

Posted: Wed May 14, 2014 5:55 pm
by DavJans
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

Re: how to print two pages or more in datagrid

Posted: Thu Apr 23, 2015 11:49 pm
by miguelchang
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

Re: how to print two pages or more in datagrid

Posted: Mon Apr 27, 2015 11:28 pm
by DavJans
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?