LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Word insert object vi only inserts first page of multipage rtf file?

Solved!
Go to solution

Hi,

 

I need to insert a multi-page rtf file into my report template.  In Microsoft Word, this is achieved by selecting 'Insert, Object, Text from File', which inserts all pages of the rtf file.  How is this achieved in the LabView Microsoft Report Generation Toolkit?  When I use the insert object vi, it only inserts the first page of the rtf file?  I've tried other insert methods but insert object is the only vi that keeps the formatting (i.e. rtf file contains tables).

 

In summary, I can insert an rtf file as an object to a bookmark, but only the first page of the rtf file is inserted.  Does anyone know how to insert a multi-page  rtf file?

 

Regards,

Allan

0 Kudos
Message 1 of 9
(3,498 Views)

Hello Allan,

Thanks for posting on the forums.

Can you please post your version of Operating System, MS Office, and LabVIEW?

Do you have sample code that I can use to recreate what you are seeing?

Regards,

Tom

Thomas C.
FlexRIO Product Support Engineer
National Instruments
0 Kudos
Message 2 of 9
(3,466 Views)

Hi Thomas,

 

Thanks for the response.  

 

Details:

 

Windows 7 Professional Service Pack 1 32-bit

2GB RAM

Intel Core Quad CPU  Q5600 @ 2.66GHz

 

Microsoft Office 2013 (also tried on Office 2010).

 

LabVIEW 2010 Service Pack 1 Version 10.0.1 (32 Bit)

 

Image of small test: I tried out: below.  'Word Insert Object vi has bookmark "rtf"  When run, the vi opens my initial template, inserts text at the text bookmark, inserts rtf file at 'rtf' bookmark.  The rtf file is six pages previously saved within Word as an rtf extension.  Only the first page of six inserts at the rtf bookmark?

Word Insert Object vi

Thanks again.

 

Regards,

Allan

 

 

0 Kudos
Message 3 of 9
(3,455 Views)

Hello Allan,

 

It looks like that functionality is not included within the Report Generation Toolkit.  It is possible to produce the desired behavior through ActiveX commands.  I was able to create some sample code that successfully inserted a multipage RTF file into a report.  I did this by using the Word._Document reference to generate a Word.Range reference.  The Range reference has an InsertFile method.  This seems to input the file at the proper location.

Forum.png

Could you give this a try and let me know how it goes?

 

Also, just so you know, you are using an unsupported configuration of MS Office and LabVIEW.  Most of the functionality should work, but there might be some glitches.

 

 

Regards,

Thomas C.
FlexRIO Product Support Engineer
National Instruments
0 Kudos
Message 4 of 9
(3,425 Views)

Cool.  Thanks Thomas.  I'll give it a try and post back.

 

Regards,

Allan

0 Kudos
Message 5 of 9
(3,414 Views)

Hi Thomas,

 

For some reason I'm unable to generate the word.range reference from the word._document reference.  Could you tell me how you generated the word.range reference.

 

Thanks,

Allan

0 Kudos
Message 6 of 9
(3,409 Views)
Solution
Accepted by topic author al94551

Hi Allan,

 

I was able to generate the code to convert the _Document to Range by copying it from the inside of the Word Insert Object.vi.  The grey VI called Word_Get_Range.vi. It is located in vi.lib\addons\_office\_wordsub.llb

 

Let me know if that helps.

 

Regards,

Tom

Thomas C.
FlexRIO Product Support Engineer
National Instruments
Message 7 of 9
(3,385 Views)

Hi Thomas,

 

Got it thanks Thomas.  Thanks again for the help, much appreciated.  Issue resolved 🙂

 

Incidently, I decided to renew my SSP and upgrade to LabVIEW 2014.

 

Regards,

Allan

0 Kudos
Message 8 of 9
(3,379 Views)

I am glad I could help.

 

Thomas C.
FlexRIO Product Support Engineer
National Instruments
0 Kudos
Message 9 of 9
(3,372 Views)