10-04-2011 01:40 PM
I would like to change font and underline when inserting text into a Microsoft Word document. I have tried using the
"Set Report Font" vi directly in front of an "Append Report Text" vi in my own application. The inserted text at the bookmark is always in the default text mode
of the document. Is this a bug?
I also tried the find and replace vi with the same result. Font will not change.
I also cannot find any examples of this usage that work. See example vi file below.
Save at C:\ or adjust the template location accordingly in the vi.
Can anyone help me out?
Thanks,
Chris
10-05-2011 01:47 PM
When you append text only the text is appended, not the formatting. It is not trivial to change the settings of a portion of a document. I don't think you can do this with the VIs of the Report Generation Toolkit. I had to create my own VI to format the text of bookmarks (see attached), you can start from there and modify it to fit your need.
note: I haven't look at your VI because I'm using LV2009.
Ben64
01-30-2013 11:33 AM
That's a cool tool Ben! However, with a bookmark, you know the location on a Word Template, and if you know the location in MS Word, you can then set the fonts you want in Word.
Do you know how to change the fonts in a string?
Example, How do you insert this block of text on a SINGLE MS Word bookmark?
PART NUMBER: 1234567890
DESCRIPTION: These lines are formated dynamically, some orders may have 1 PN, and other orders many have 500 PNs.
I'm formatting my line details and inserting them on a MS Word bookmark. After the initial bookmark I have no more control of the fonts for the entire string block. I'd like to dynamically change the fonts in a string and I'd like to use MS Word. I saw HTML report writing, but, in my particular application, HTML reports will not work.
Doug
01-30-2013 12:25 PM
@Dhubbell wrote:
That's a cool tool Ben! However, with a bookmark, you know the location on a Word Template, and if you know the location in MS Word, you can then set the fonts you want in Word.
Do you know how to change the fonts in a string?
Example, How do you insert this block of text on a SINGLE MS Word bookmark?PART NUMBER: 1234567890
DESCRIPTION: These lines are formated dynamically, some orders may have 1 PN, and other orders many have 500 PNs.
I'm formatting my line details and inserting them on a MS Word bookmark. After the initial bookmark I have no more control of the fonts for the entire string block. I'd like to dynamically change the fonts in a string and I'd like to use MS Word. I saw HTML report writing, but, in my particular application, HTML reports will not work.
Doug
I don't have the time to try anything but as a suggestion I would experiment with the range start end properties (e.g. from start =0 to end =
12 bold is true, from 13 to 23 bold is false, ....) You first insert text without formatting then you use the range start and end to format the text.
I'm not sure it will work but it's worth a try.
Ben64
note: I would create a 2D array of start and end index of your string and auto-index a for loop that contain the range property node.