06-09-2011 03:55 AM
Hello,
I have created a multipage report in word. I would like the user to be able to print the pages selected (as in word printing: pages: 1, 2-3);
I am using Office 2007 pro, the LabVIEW Report Gen Toolkit, LabVIEW 2009, and Windows XP.
I used the suggestion in thread:
http://forums.ni.com/t5/LabVIEW/How-can-you-print-a-single-page-of-a-multipage-report/m-p/155233 , modifying the print VI that comes shipped with LabVIEW: NI_ReportGenerationToolkit.lvlib:Word_Print.VI.
first of all I put two integer constants on "From" and "To" in the Invoke node (PrintOut), but Labview return an error:
Error 1015 occurred at NI_ReportGenerationToolkit.lvlib:Word_Print.vi -> NI_Word.lvclass:Print Report.vi -> print2.vi
Then I searched for PrintOut Method in word 2007 Reference guide, and I saw that for using From and To the Range field must have the string wdPrintFromTo;
I insert wdPrintFromTo string in RANGE Field and tryed.... same error......
After that I change approach; removed all constants and used the field Pages; I put a string "1-2" connected to this field and now the printer respond, but all pages was printed!
What's wrong?
many thanks
06-10-2011 02:06 AM
Hello,
try to take a look at the following documents:
http://digital.ni.com/public.nsf/allkb/DC08B6A56DBE00A586256F1D006826DC?OpenDocument
http://digital.ni.com/public.nsf/allkb/C603AC51B468156986256F310061407D?OpenDocument
Let me know if this helps.
Regards,
Alex
06-14-2011 07:30 AM
Thanks, Alex!
ok, I try first approach in print4.vi, but Labview return an error (view jpg); if I cut From, To controls, the VI print all pages. The same things happen also if I trasform I32 in Variant.
I don't try second approach, because at this time I have only one report
I try also with VB macro: this is better (print3.vi) but.....if I use:
Sub Print_Pages_From_To()
ActiveDocument.ActiveWindow.PrintOut Range:=wdPrintFromTo, From:="2", To:="3"
End Sub
is ok; print the pages selected; if I use:
Sub PrintPages()
ActiveDocument.ActiveWindow.PrintOut Pages:="2-3"
End Sub
printer print all pages.
what do you think?
regards,
Italo